ifcopenshell.api.attribute.edit_attributes

Module Contents

ifcopenshell.api.attribute.edit_attributes.edit_attributes(file: ifcopenshell.file, product: ifcopenshell.entity_instance, attributes: dict[str, Any]) None

Edit the attributes of a product

All IFC entities have attributes. Normally they can be edited directly, by simply assigning a new value to them. In some scenarios, you may wish to also ensure that ownership history is updated. This function provides that convenience.

The method will maintain consistency for PredefinedType attribute based on whether ElementType/ObjectType and whether occurrence is typed:

  • PredefinedType and ObjectType to be None if occurrence is typed

  • PredefinedType to be “NOTDEFINED” if ElementType/ObjectType is None

  • PredefinedType to be “USERDEFINED” if ElementType/ObjectType is not None

Parameters:
  • product (ifcopenshell.entity_instance) – The product you want to edit. This may be any rooted IFC entity.

  • attributes (dict) – a dictionary of attribute names and values.

Returns:

None

Return type:

None

Example:

element = ifcopenshell.api.root.create_entity(model, ifc_class="IfcWall")
ifcopenshell.api.attribute.edit_attributes(model,
    product=element, attributes={"Name": "Waldo"})