Model.modent_addcontentsbyids#

Model.modent_addcontentsbyids(modular_entity, content_entity_type, content_entity_ids, representation_key=s_defaultString)#

Adds entities to a modular entity via IDs. Selection by IDs is mainly useful for adding include entities, which cannot be selected by collection.

When modular entity is subsystem, only one include entity can be associated with it. Also, if an include entity is already associated with a subsystem, it cannot be re-associated with another subsystem.

Parameters:
  • modular_entity (Entity) – The object describing the modular entity to update. Valid entities subsystemconfigurations, subsystems and subsystemsets.

  • content_entity_type (hwString) – The type of entity to add.

  • content_entity_ids (hwIntList) – A quoted list of the entity IDs to add. If the type of modular_entity is subsystem and content_entity_type is include, only one content_entity_id can be used.

  • representation_key (hwString) – The representation key of the subsystem to populate. This defaults to the only realized representation and can be omitted.

Example#

Add the contents of subsystem ID 4 to subsystem ID 2#
import hm
import hm.entities as ent

model = hm.Model()

model.modent_addcontentsbyids(
    modular_entity=ent.Subsystem(model, 2),
    content_entity_type="subsystems",
    content_entity_ids=[4],
)