Model.attributeupdateentity#

Model.attributeupdateentity(entity, identifier, solver, status, targetentity)#

Updates an attribute of type entity.

Parameters:
  • entity (Entity) – The object describing the entity that owns the attribute.

  • identifier (int) – The identifier of the attribute.

  • solver (int) – The solver number of the attribute.

  • status (int) – The status of the attribute.

  • behavior (int) – The behavior of the attribute.

  • targetentity (Entity) – The object describing the entity to be set at the attribute.

Example#

Update the load collector with ID 11 in * CDSMETH_OSET * dataname (identifier=517 ) in Optistruct profile by set the set with ID 6#
import hm
import hm.entities as ent

model = hm.Model()

# Finding the CDSMETH_OSET identifier using the hm_attributeidentifier function
_, r = model.hm_attributeidentifier(
    entity_type=ent.Loadcol, entity_id=11, attribute_name_or_id="CDSMETH_OSET"
)

# Setting the dataname
model.attributeupdateentity(
    entity=ent.Loadcol(model, 11),
    identifier=r.id,
    solver=1,
    status=2,
    behavior=0,
    targetentity=ent.Set(model, 6),
)