ifcopenshell.api.geometry.copy_representation¶
Module Contents¶
- ifcopenshell.api.geometry.copy_representation.copy_representation(file: ifcopenshell.file, source: ifcopenshell.entity_instance, target: ifcopenshell.entity_instance, context_identifier: str = 'Body') ifcopenshell.entity_instance | None¶
Copy a geometric representation from one element to another.
Finds the named representation on
source, deep-copies its entity graph (geometry items, profiles, placements, etc.), and assigns the copy totarget. Representation contexts are shared rather than copied. Iftargetalready has a matching representation it is removed and replaced.If no matching representation is found on
source, returnsNoneand leavestargetunchanged.- Parameters:
source – The element to copy the representation from.
target – The element to assign the copied representation to.
context_identifier – The RepresentationIdentifier to look up on
source(e.g."Body","Axis","Box"). Defaults to"Body".
- Returns:
The newly created IfcShapeRepresentation, or None if no matching representation was found on
source.
Example:
wall_a = model.by_id(1) wall_b = model.by_id(2) # Give wall_b the same body geometry as wall_a. ifcopenshell.api.geometry.copy_representation(model, source=wall_a, target=wall_b)