Session and Model class#
HyperMesh application supports multiple instances of HyperMesh client window. We simply refer to it as the multi-model setup.
This feature allows user to work with multiple HyperMesh models within a single session and have them organized side-by-side on a single page thanks to the multi-window layout. It enabled the introduction of new workflows such as copy & paste data from one model to another.
The same way as you can work with multiple models simultaneously in the GUI, you can perform operations via Python API on different models within a single code. Two classes have been put in place to provide mechanism to manage this scenario - the Session class and the Model class.
hm.Session Class#
The HyperMesh client Session class oversees all HyperMesh models within
a single running application. Please note this is a different class to
hw.Session()
.
hm.Session()
provides methods to return the name of the current (active)
HyperMesh model and to list the names of all HyperMesh models available
in the session.
hm.Model Class#
The Model class represents a HyperMesh model. From the Python API perspective, this is the main access point when working with your model. The model object is required when performing most of the actions - creating new entities, querying existing entities, creating collections…
When creating a model instance via the class constructor, you may pass the name of the model you want to work with. If no name is provided, the Model object will be linked to the active model by default.
All HyperMesh client commands (also referred to as HyperMesh services) are exposed as instance methods of the Model class. Performing an operation on a specific model requires creating a model object representing the corresponding model and then calling the method via its object.
More details on how the HyperMesh functions/methods (also known as Modify and Query commands in the Tcl API) are exposed in Python can be found in the HyperMesh Functions section.