mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 07:36:47 +00:00
WIP refactor context UI into its own module. Remove dependency to Blender properties. See #1222.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import blenderbim.bim.ifc
|
||||
|
||||
is_loaded = False
|
||||
|
||||
class Data:
|
||||
is_loaded = False
|
||||
contexts = {}
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
file = blenderbim.bim.ifc.IfcStore.get_file()
|
||||
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
|
||||
Reference in New Issue
Block a user