2021-01-03 19:09:01 +11:00
|
|
|
from blenderbim.bim.ifc import IfcStore
|
2021-01-03 12:08:00 +11:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Data:
|
|
|
|
|
is_loaded = False
|
|
|
|
|
contexts = {}
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def load(cls):
|
2021-01-03 19:09:01 +11:00
|
|
|
file = IfcStore.get_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 = {}
|
|
|
|
|
# See bug #1224 for why we don't use HasSubContexts
|
|
|
|
|
for subcontext in file.by_type("IfcGeometricRepresentationSubContext"):
|
|
|
|
|
if subcontext.ParentContext != context:
|
|
|
|
|
continue
|
|
|
|
|
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
|