mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 05:22:06 +00:00
Add ability to map representations. See #1222.
This commit is contained in:
@@ -14,4 +14,23 @@ class Usecase:
|
||||
[self.file.remove(s) for s in subelement.StyledByItem]
|
||||
elif subelement.is_a("IfcRepresentation"):
|
||||
subelement.ContextOfItems = dummy_context
|
||||
self.purge_representation_inverses(subelement)
|
||||
self.purge_representation_inverses(self.settings["representation"])
|
||||
ifcopenshell.util.element.remove_deep(self.file, self.settings["representation"])
|
||||
|
||||
def purge_representation_inverses(self, element):
|
||||
for inverse in self.file.get_inverse(element):
|
||||
if inverse.is_a("IfcPresentationLayerAssignment"):
|
||||
assigned_items = set(inverse.AssignedItems)
|
||||
if len(assigned_items) == 1:
|
||||
self.file.remove(inverse)
|
||||
else:
|
||||
assigned_items.remove(element)
|
||||
inverse.AssignedItems == list(assigned_items)
|
||||
elif inverse.is_a("IfcProductRepresentation"):
|
||||
representations = set(inverse.Representations)
|
||||
if len(representations) == 1:
|
||||
self.file.remove(inverse)
|
||||
else:
|
||||
representations.remove(element)
|
||||
inverse.Representations = list(representations)
|
||||
|
||||
Reference in New Issue
Block a user