Entity Classes#
Each HyperMesh entity type is represented by a corresponding class in the hm.entities Module. Consequently, every HyperMesh entity can be represented as a Python object. This object-oriented approach provides users with more power and flexibility. While in Tcl, entities are referred to mostly by their internal IDs, Python API works with entity objects.
The only exception is the include files (includes). Although they are treated as an entity type, include files are not a true entity, hence they do not have a dedicated Python class. This means that wherever an include or include entity type needs to be referenced, user is asked to supply the include ID (rather than a Python object) or refer to the entity type by the name string “includes” (rather that a Python class).
The entity class constructor has a dual functionality - it can be used to create a Python object representing an existing entity or it can be used to create a new entity and its Python object at the same time (see example below).
import hm
import hm.entities as ent
# Creating a Python object for property ID 10
model = hm.Model()
prop_10 = ent.Property(model,10)
# Creating a new property and its Python object
new_prop = ent.Property(model)
Via their attributes, entity objects provide users easy access to various entity characteristics. These attributes represent what we call in Tcl the entity Data Names. While many attributes might be available for a specific entity type across all its possible variations, each entity carries only attributes relevant to its configuration defined by the cardimage or config attribute.
Certain entity types use several configurations that differ significantly from each other and cannot be converted from one to another. In other words, for those entity types the entity configuration must be defined at the time of entity creation and it cannot be altered throughout the lifetime of the entity. In Python API, this setup is captured by providing a separate class for each configuration, each derived from a common base class that represents the core HyperMesh entity type. The table below shows which entity types follow this setup.
Entity Type |
Configuration |
Python Entity Class |
---|---|---|
Designpoints |
1 |
DesignpointUndefined |
80 |
DesignpointImpactPoint |
|
81 |
DesignpointTargetPoint |
|
Designpointmethods |
1 |
DesignpointmethodUndefined |
2 |
DesignpointmethodESAComp |
|
Designpointsets |
1 |
DesignpointsetGeneric |
2 |
DesignpointsetBeam |
|
5 |
DesignpointsetRivets |
|
7 |
DesignpointsetSprings |
|
10 |
DesignpointsetBeamMember |
|
11 |
DesignpointsetBeamShellMember |
|
12 |
DesignpointsetBeamShell |
|
13 |
DesignpointsetBeamJoint |
|
14 |
DesignpointsetBeamShellSingle |
|
30 |
DesignpointsetPanelMetallic |
|
31 |
DesignpointsetPanelComposite |
|
32 |
DesignpointsetPanelStiffened |
|
34 |
DesignpointsetComposite |
|
40 |
DesignpointsetWeld |
|
80 |
DesignpointsetPedestrian |
|
81 |
DesignpointsetFMVSS |
|
82 |
DesignpointsetDummy |
|
83 |
DesignpointsetInstrumentPanelImpactPoint |
|
Loads |
9 |
LoadAcceleration |
3 |
LoadConstraint |
|
6 |
LoadFlux |
|
1 |
LoadForce |
|
2 |
LoadMoment |
|
4 |
LoadPressure |
|
5 |
LoadTemperature |
|
8 |
LoadVelocity |
|
Plotcontrols |
2 |
PlotcontrolContour |
5 |
PlotcontrolDeformed |
|
7 |
PlotcontrolFBD |
|
6 |
PlotcontrolMarker |
|
4 |
PlotcontrolTensor |
|
3 |
PlotcontrolVector |
|
Structuralproperty |
1 |
StructuralpropertyUndefined |
80 |
StructuralpropertyHeadForm |
|
81 |
StructuralpropertyUpperLegForm |
|
82 |
StructuralpropertyLowerLegForm |
|
83 |
StructuralpropertyDummyTargets |
|
84 |
StructuralpropertyInstrumentPanelIP |
|
85 |
StructuralpropertyEjectionMitigationIP |
|
100 |
StructuralpropertyBeam |
|
116 |
StructuralpropertyComposite |
|
117 |
StructuralpropertyWeld |
|
118 |
StructuralpropertyRivet |
|
300 |
StructuralpropertySpring |
|
400 |
StructuralpropertyPanelComposite |
|
401 |
StructuralpropertyPanelMetallic |
|
500 |
StructuralpropertyGeneric |