Model.CE_FE_RegisterSharedEntitiesByMark#

Model.CE_FE_RegisterSharedEntitiesByMark(collection, existing_entities)#

Registers pre-existing entities to multiple connectors.

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

Parameters:
  • collection (Collection) – The collection containing the connector entities to register to.

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

Example#

Register pre-existing FE to connectors with IDs 1-10#
import hm
import hm.entities as ent

model = hm.Model()

# Change connectors 1-10 to the user control mode:
ce = hm.Collection(model, ent.Connector, list(range(1, 11)))
model.CE_SetSpecificDetail(connector_collection=ce, detail_type=2, integer_value=1, double_value=0.0)

# 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)

# Create the collection containing the connector entities with IDs 1-10:
ce = hm.Collection(model, ent.Connector, list(range(1, 11)))
# Register the entities with connector 7:
model.CE_FE_RegisterSharedEntitiesByMark(
    collection=ce,
    existing_entities=collection_set
)

# Change connectors 1-10 back to normal control mode (optional):
ce = hm.Collection(model, ent.Connector, list(range(1, 11)))
model.CE_SetSpecificDetail(connector_collection=ce, detail_type=2, integer_value=0, double_value=0.0)