'd like to ask for your guidance, @Michael Herve.
I'm currently using the recording feature in HyperMesh and noticed that the recorded Python script does not show the element IDs, specifically at the part I've circled in red in the attached image. The generated command looks like this:
collection = hm.Collection(model, hm.FilterByEnumeration(ent.Element, ids=
hm.hwUIntList([])))
recording cotext
import hm
import hm.entities as ent
def run():
model = hm.Model()
# [TCL]: *startnotehistorystate {elemoffset}
model.startnotehistorystate(name="elemoffset")
# [TCL]: *createmark elements 1
# [TCL]: *elemoffset 1 4 0 0 0 0 0 0.25 0 1 1
collection = hm.Collection(model, hm.FilterByEnumeration(ent.Element, ids=hm.hwUIntList([])))
model.elemoffset(collection=collection, density=4, bias_style=0, bias=0, initial_offset=0, corner_type=0, thickness_type=0, thickness=0.25, shells_only=0, offset_type=1, component_flag=1)
# [TCL]: *endnotehistorystate {elemoffset}
model.endnotehistorystate(name="elemoffset")
As you can see, the ids
are always empty and are not captured by the recorder. Is this a bug, or am I missing something? Could anyone help clarify how to correctly retrieve these IDs using Python?
Additionally, I have two more Python-related questions since I'm more familiar with TCL scripting:
there is a example:
When performing an offset operation (facet), and selecting elements on the top surface (shown by the arrow):
- How can I select these top surface elements using Python based on a specified height (Z-value)?
- Alternatively, how can I select the top surface elements by using an on-plane selection criterion with Python?
Here is the TCL syntax for the model (for your convenience to copy and use directly):
*solidblock 0 0 0 1 0 0 0 1 0 0 0 0.5
*createmark solids 1 1
*solidmap_solids_begin3 solidmark=1 elemsize=0.250000 elem_type=2 orthogonal_extrusion=0 create_boundary=0 skip_non_mappable=1
*solidmap_solids_end