ifcopenshell.api.root.copy_class#

Module Contents#

class ifcopenshell.api.root.copy_class.Usecase(file, product=None)#

Copies a product

The following relationships are also duplicated:

  • The copy will have the same object placement coordinates as the original.

  • The copy will have duplicated property sets, properties, and quantities

  • The copy will have all nested distribution ports copied too

  • The copy will be part of the same aggregate

  • The copy will be contained in the same spatial structure

  • The copy, if it is an occurrence, will have the same type

  • Voids are duplicated too

  • The copy will have the same material as the original. Parametric material set usages will be copied.

  • The copy will be part of the same groups as the original.

Be warned that:

  • Representations are _not_ copied. Copying representations is an expensive operation so for now the user is responsible for handling representations.

  • Filled voids are not copied, as there is no guarantee that the filling will also be copied.

  • Path connectivity is not copied, as there is no guarantee that the connections are still valid.

Parameters

product – The IfcProduct to copy.

Returns

The copied product

Return type

ifcopenshell.entity_instance.entity_instance

Example:

# We have a wall
wall = ifcopenshell.api.run("root.create_entity", model, ifc_class="IfcWall")

# And now we have two
wall_copy = ifcopenshell.api.run("root.copy_class", model, product=wall)
copy_direct_attributes(self, to_element)#
copy_indirect_attributes(self, from_element, to_element)#
copy_object_placements(self, element)#
copy_psets(self, element)#
execute(self)#
remove_representations(self, element)#