Model.CE_FE_RegisterSharedEntities#

Model.CE_FE_RegisterSharedEntities(connector, existing_entities)#

Registers pre-existing entities to a single connector.

Note that a single entity can be registered with multiple connectors.

Parameters:
  • connector (Entity) – The object describing the connector entity to register to.

  • existing_entities (CollectionSet) – The set of collections containing possibly multiple type of entities.

Example#

Register pre-existing FE to connector with ID 10#
import hm
import hm.entities as ent

model = hm.Model()

# First, change connector 10 to the user control mode:
model.CE_SetSpecificDetailById(ce_id=10, detail_type=2, int_val=1, dbl_val=0)

# Second, create the necessary collection set to register collections of multiple types of entities:
collection_set = hm.CollectionSet(model)
# Create collection of component entity with ID 3 and add to collection set:
component_1 = hm.Collection(model, ent.Component, [3])
collection_set.set(component_1)
# Create collection of property entity with ID 7 and add to collection set:
property_1 = hm.Collection(model, ent.Property, [7])
collection_set.set(property_1)
# Create collection of material entity with ID 8 and add to collection set:
material_1 = hm.Collection(model, ent.Material, [8])
collection_set.set(material_1)
# Create collection of set entity with ID 12 and add to collection set:
set_1 = hm.Collection(model, ent.Set, [12])
collection_set.set(set_1)
# Create collection of group entity with ID 14 and add to collection set:
group_1 = hm.Collection(model, ent.Group, [14])
collection_set.set(group_1)

# Third, register the entities with connector 10:
model.CE_FE_RegisterSharedEntities(
    connector=ent.Connector(model, 10),
    existing_entities=collection_set
)

# Finally, turn the user control mode off for connector 10 (optional):
model.CE_SetSpecificDetailById(ce_id=10, detail_type=2, int_val=0, dbl_val=0)