First attempt at ripping out agnostic code into ifcopenshell.api namespace. See #1399.

This commit is contained in:
Dion Moult
2021-03-25 10:48:31 +11:00
parent 911d703f57
commit d77bc6bdaa
190 changed files with 388 additions and 437 deletions
@@ -0,0 +1,27 @@
class Data:
is_loaded = False
contexts = {}
@classmethod
def purge(cls):
cls.is_loaded = False
cls.contexts = {}
@classmethod
def load(cls, file):
if not file:
return
cls.contexts = {}
for context in file.by_type("IfcGeometricRepresentationContext", include_subtypes=False):
subcontexts = {}
for subcontext in context.HasSubContexts:
subcontexts[int(subcontext.id())] = {
"ContextType": subcontext.ContextType,
"ContextIdentifier": subcontext.ContextIdentifier,
"TargetView": subcontext.TargetView,
}
cls.contexts[int(context.id())] = {
"ContextType": context.ContextType,
"HasSubContexts": subcontexts
}
cls.is_loaded = True