WIP merge MVDs into geometry workarounds UI. Cleaner, more usable import / export UI. Remove obsoleted MVD options. See #1222.

This commit is contained in:
Dion Moult
2021-01-24 14:33:56 +11:00
parent 900aa20e10
commit 9d893d2c5a
15 changed files with 191 additions and 226 deletions
@@ -1,3 +1,5 @@
import ifcopenshell.util.element
class Usecase:
def __init__(self, file, settings=None):
self.file = file
@@ -6,17 +8,10 @@ class Usecase:
self.settings[key] = value
def execute(self):
styles = []
dummy_context = self.file.create_entity("IfcRepresentationContext")
for subelement in self.file.traverse(self.settings["representation"]):
if subelement.is_a("IfcRepresentationItem") and subelement.StyledByItem:
styles.append(subelement)
for style in styles:
self.remove_deep(style)
self.remove_deep(self.settings["representation"])
def remove_deep(self, element):
subgraph = list(self.file.traverse(element))
subgraph_set = set(subgraph)
for ref in subgraph[::-1]:
if ref.id() and len(set(self.file.get_inverse(ref)) - subgraph_set) == 0:
self.file.remove(ref)
[self.file.remove(s) for s in subelement.StyledByItem]
elif subelement.is_a("IfcRepresentation"):
subelement.ContextOfItems = dummy_context
ifcopenshell.util.element.remove_deep(self.file, self.settings["representation"])