Model.createnewsetandsubobject#

Model.createnewsetandsubobject(entitytype, name='', config=0, element_type=0, entity_ids=hwIntList())#

Creates a new set of type subobject with specified data.

Parameters:
  • entitytype (EntityFullType) – The type of entity set subobject. Valid entity classes are components, nodes, assemblies, solversubmodels, sets, elements, boxes, segments, planes, and ellipses.

  • name (hwString) – The name of the set.

  • config (unsigned int) – The subobject config corresponding to the entitytype.

  • element_type (unsigned int) – Type of element to be declared when entitytype is the element class.

  • entity_ids (hwIntList) – The list of entity IDs to be assigned to the subobject.

Example#

Create a set with all the nodes#
import hm
import hm.entities as ent

model = hm.Model()

all_nodes = hm.Collection(model, ent.Node)

model.createnewsetandsubobject(
    entitytype=ent.Set,
    name="set1",
    config=0,
    element_type=0,
    entity_ids=[node.id for node in all_nodes]
)