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 hw Module).

  • import hm will give you access to HyperMesh client classes and functions (see hm Module).

  • import hm.entities will give you access to HyperMesh client entity classes (see hm.entities Module).

  • import hw.hv will import the HyperView classes (see hw.hv Module).

  • import hw.hg will import the HyperGraph classes (see hw.hg Module).

  • import hw.taskmanager will import the Task Manager classes (see hw.taskmanager Module).

  • import hwx.gui will import the GUI Toolkit classes (see GUI Toolkit).


_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.