mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Fix #2712. Handle deletion of rel services buildings.
This commit is contained in:
@@ -76,11 +76,7 @@ class Usecase:
|
|||||||
ifcopenshell.api.run("grid.remove_grid_axis", self.file, axis=axis)
|
ifcopenshell.api.run("grid.remove_grid_axis", self.file, axis=axis)
|
||||||
|
|
||||||
# TODO: remove object placement and other relationships
|
# TODO: remove object placement and other relationships
|
||||||
|
for inverse in self.file.get_inverse(self.settings["product"]):
|
||||||
# Use a while loop so that we don't keep inverses in memory that might
|
|
||||||
# get deleted as a result of the API calls in the loop body (#2697)
|
|
||||||
while inverses := self.file.get_inverse(self.settings["product"]):
|
|
||||||
inverse = next(iter(inverses))
|
|
||||||
if inverse.is_a("IfcRelDefinesByProperties"):
|
if inverse.is_a("IfcRelDefinesByProperties"):
|
||||||
ifcopenshell.api.run(
|
ifcopenshell.api.run(
|
||||||
"pset.remove_pset",
|
"pset.remove_pset",
|
||||||
@@ -102,6 +98,8 @@ class Usecase:
|
|||||||
self.file.remove(inverse)
|
self.file.remove(inverse)
|
||||||
elif inverse.is_a("IfcRelVoidsElement"):
|
elif inverse.is_a("IfcRelVoidsElement"):
|
||||||
self.file.remove(inverse)
|
self.file.remove(inverse)
|
||||||
|
elif inverse.is_a("IfcRelServicesBuildings"):
|
||||||
|
self.file.remove(inverse)
|
||||||
elif inverse.is_a("IfcRelNests"):
|
elif inverse.is_a("IfcRelNests"):
|
||||||
if inverse.RelatingObject == self.settings["product"]:
|
if inverse.RelatingObject == self.settings["product"]:
|
||||||
for subelement in inverse.RelatedObjects:
|
for subelement in inverse.RelatedObjects:
|
||||||
|
|||||||
Reference in New Issue
Block a user