mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +00:00
#2094. Removing materials now removes material definitions too for styles
This commit is contained in:
@@ -29,8 +29,8 @@ class Usecase:
|
||||
def execute(self):
|
||||
inverse_elements = self.file.get_inverse(self.settings["material"])
|
||||
self.file.remove(self.settings["material"])
|
||||
# TODO: this is probably not robust enough
|
||||
# TODO: purge material definition representation
|
||||
# TODO: Right now, we we choose only to delete set items (e.g. a layer) but not the material set
|
||||
# This can lead to invalid material sets, but we assume the user will deal with it
|
||||
for inverse in inverse_elements:
|
||||
if inverse.is_a("IfcMaterialConstituent"):
|
||||
self.file.remove(inverse)
|
||||
@@ -40,3 +40,9 @@ class Usecase:
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcRelAssociatesMaterial"):
|
||||
self.file.remove(inverse)
|
||||
elif inverse.is_a("IfcMaterialDefinitionRepresentation"):
|
||||
for representation in inverse.Representations:
|
||||
for item in representation.Items:
|
||||
self.file.remove(item)
|
||||
self.file.remove(representation)
|
||||
self.file.remove(inverse)
|
||||
|
||||
Reference in New Issue
Block a user