FAQ - Python for HyperMesh
This article is a collection of the questions which we collected through support requests for usage of Python from HyperMesh 2024, and which are not documented yet in the online help.
How can I access the data in the collections created by HyperMesh apart of using loops?
The collection can be turned into a list. It can be an expensive operation depending on the size of the collection,hence the collection does not behave as a list natively.
How to deal with Collection outputs (collection set)?
In Python, the user has to supply an empty collection that gets populated by the function – a concept very different to Tcl where you specify mark ID and then query the mark afterwards. The example below shows how to get duplicated elements.
If you want to access same ids in your Collection, you can access them from their index (see line 16 and 17 above), or loop over the entities of your collection:
[e.id for e in col]
Why can’t I get list of attached entities with Python command findmark?
We detected an issue with HyperMesh 2024.0 and Python command for findmark, which will be corrected in the future versions.
What is the equivalent of tcl command *marktousermark?
As many tcl commands, *marktousermark has been transposed to marktousermark in Python:
When transposing the tcl command to Python, please note the tcl arguments entity_type and mark_id are replaced by a single argument in Python, which is the Collection name (see example above).