2021-01-03 12:08:00 +11:00
|
|
|
class Data:
|
|
|
|
|
is_loaded = False
|
|
|
|
|
contexts = {}
|
|
|
|
|
|
2021-02-03 17:30:19 +11:00
|
|
|
@classmethod
|
|
|
|
|
def purge(cls):
|
|
|
|
|
cls.is_loaded = False
|
|
|
|
|
cls.contexts = {}
|
|
|
|
|
|
2021-01-03 12:08:00 +11:00
|
|
|
@classmethod
|
2021-03-25 10:48:31 +11:00
|
|
|
def load(cls, file):
|
2021-01-03 12:08:00 +11:00
|
|
|
if not file:
|
|
|
|
|
return
|
|
|
|
|
cls.contexts = {}
|
|
|
|
|
for context in file.by_type("IfcGeometricRepresentationContext", include_subtypes=False):
|
|
|
|
|
subcontexts = {}
|
2021-02-24 12:51:50 +11:00
|
|
|
for subcontext in context.HasSubContexts:
|
2021-01-03 12:08:00 +11:00
|
|
|
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
|