mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Removing products now handles purging a bunch more inverse relationships
This commit is contained in:
@@ -78,9 +78,10 @@ class Usecase:
|
||||
if to_element.ObjectPlacement:
|
||||
new_opening.ObjectPlacement.PlacementRelTo = to_element.ObjectPlacement
|
||||
# For now, we do copy opening representations
|
||||
new_opening.Representation = ifcopenshell.util.element.copy_deep(
|
||||
self.file, opening.Representation
|
||||
)
|
||||
if opening.Representation:
|
||||
new_opening.Representation = ifcopenshell.util.element.copy_deep(
|
||||
self.file, opening.Representation
|
||||
)
|
||||
elif inverse.is_a("IfcRelFillsElement"):
|
||||
continue
|
||||
elif inverse.is_a("IfcRelConnectsPathElements"):
|
||||
|
||||
@@ -53,7 +53,24 @@ class Usecase:
|
||||
|
||||
# TODO: remove object placement and other relationships
|
||||
for inverse in self.file.get_inverse(self.settings["product"]):
|
||||
if inverse.is_a("IfcRelFillsElement"):
|
||||
if inverse.is_a("IfcRelDefinesByProperties"):
|
||||
ifcopenshell.api.run(
|
||||
"pset.remove_pset",
|
||||
self.file,
|
||||
product=self.settings["product"],
|
||||
pset=inverse.RelatingPropertyDefinition,
|
||||
)
|
||||
elif inverse.is_a("IfcRelAssociatesMaterial"):
|
||||
ifcopenshell.api.run("material.unassign_material", self.file, product=self.settings["product"])
|
||||
elif inverse.is_a("IfcRelDefinesByType"):
|
||||
if inverse.RelatingType == self.settings["product"]:
|
||||
for related_object in inverse.RelatedObjects:
|
||||
ifcopenshell.api.run("type.unassign_type", self.file, related_object=related_object)
|
||||
else:
|
||||
ifcopenshell.api.run("type.unassign_type", self.file, related_object=self.settings["product"])
|
||||
elif inverse.is_a("IfcRelSpaceBoundary"):
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcRelFillsElement"):
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcRelVoidsElement"):
|
||||
self.file.remove(inverse)
|
||||
|
||||
Reference in New Issue
Block a user