Getting Started#

Interacting with the application clients via Python API can be done in multiple ways. Direct execution of API calls can be performed using the IPython console, which can be activated in the View pull down menu by clicking on Python Window.

_images/view_python.png

Figure 1. View pulldown menu.

Once you are in the console, you can execute standard Python calls and import various packages you intend to work with. import hw will give you access to the framework classes and functions (see Framework Package), import hw.hv will import the HyperView classes (see HyperView Package) and import hw.hg will import the HyperGraph classes (see HyperGraph Package).

Note

This release supports framework classes (Session, Page, Window, etc.), standard HyperView plotting (Scalar, Vector, Tensor) and HyperGraph Line Chart (XY Plots). Exporting images, H3D models and curves in different formats is also supported. The Python API coverage will be extended in the future releases.

_images/python_console.png

Figure 2. Python Window.

The Python 3.8.10 distribution included in the HyperMesh installation includes hundreds of popular packages and libraries like Pandas, NumPy, SciPy, TensorFlow, openpyxl, etc. You can retrieve a full list of accessible Python modules by calling help("modules")

If you have a Python script ready that you want to run in the application, you can call it using the built-in IPython magic command run <file_path> or %run <file_path>:

run "C:/MyPythonScripts/HyperView_report.py"

Python scripts can also be included in an Extension package and linked to actions that can be exposed in a ribbon, a pulldown menu or a toolbar.