Elements with filled openings don't have their openings copied, as it depends on the fill

This commit is contained in:
Dion Moult
2022-10-09 22:22:12 +11:00
parent bdbd874fa8
commit 32f0911479
2 changed files with 21 additions and 10 deletions
@@ -72,16 +72,18 @@ class Usecase:
continue
elif inverse.is_a("IfcRelVoidsElement") and inverse.RelatingBuildingElement == from_element:
opening = inverse.RelatedOpeningElement
new_opening = ifcopenshell.api.run("root.copy_class", self.file, product=opening)
new_opening.VoidsElements[0].RelatingBuildingElement = to_element
if new_opening.ObjectPlacement and new_opening.ObjectPlacement.is_a("IfcLocalPlacement"):
if to_element.ObjectPlacement:
new_opening.ObjectPlacement.PlacementRelTo = to_element.ObjectPlacement
# For now, we do copy opening representations
if opening.Representation:
new_opening.Representation = ifcopenshell.util.element.copy_deep(
self.file, opening.Representation, exclude=["IfcGeometricRepresentationContext"]
)
# We don't copy filled openings, since there is no guarantee the filling is also copied
if not opening.HasFillings:
new_opening = ifcopenshell.api.run("root.copy_class", self.file, product=opening)
new_opening.VoidsElements[0].RelatingBuildingElement = to_element
if new_opening.ObjectPlacement and new_opening.ObjectPlacement.is_a("IfcLocalPlacement"):
if to_element.ObjectPlacement:
new_opening.ObjectPlacement.PlacementRelTo = to_element.ObjectPlacement
# For now, we do copy opening representations
if opening.Representation:
new_opening.Representation = ifcopenshell.util.element.copy_deep(
self.file, opening.Representation, exclude=["IfcGeometricRepresentationContext"]
)
elif inverse.is_a("IfcRelFillsElement"):
continue
elif inverse.is_a("IfcRelConnectsPathElements"):