mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-30 12:09:51 +00:00
Fix #2055. Disable IfcContext in IFC2X3 because it didn't exist.
This commit is contained in:
@@ -33,12 +33,38 @@ class IfcClassData:
|
|||||||
def load(cls):
|
def load(cls):
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
cls.data = {
|
cls.data = {
|
||||||
|
"ifc_products": cls.ifc_products(),
|
||||||
"contexts": cls.contexts(),
|
"contexts": cls.contexts(),
|
||||||
"has_entity": cls.has_entity(),
|
"has_entity": cls.has_entity(),
|
||||||
"name": cls.name(),
|
"name": cls.name(),
|
||||||
"ifc_class": cls.ifc_class(),
|
"ifc_class": cls.ifc_class(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def ifc_products(cls):
|
||||||
|
products = [
|
||||||
|
"IfcElement",
|
||||||
|
"IfcElementType",
|
||||||
|
"IfcSpatialElement",
|
||||||
|
"IfcGroup",
|
||||||
|
"IfcStructuralItem",
|
||||||
|
"IfcContext",
|
||||||
|
"IfcAnnotation",
|
||||||
|
"IfcRelSpaceBoundary",
|
||||||
|
]
|
||||||
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
|
products = [
|
||||||
|
"IfcElement",
|
||||||
|
"IfcElementType",
|
||||||
|
"IfcSpatialStructureElement",
|
||||||
|
"IfcGroup",
|
||||||
|
"IfcStructuralItem",
|
||||||
|
"IfcAnnotation",
|
||||||
|
"IfcRelSpaceBoundary",
|
||||||
|
]
|
||||||
|
return [(e, e, "") for e in products]
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def contexts(cls):
|
def contexts(cls):
|
||||||
results = []
|
results = []
|
||||||
|
|||||||
@@ -33,16 +33,13 @@ from bpy.props import (
|
|||||||
CollectionProperty,
|
CollectionProperty,
|
||||||
)
|
)
|
||||||
|
|
||||||
products_enum = []
|
|
||||||
classes_enum = []
|
classes_enum = []
|
||||||
types_enum = []
|
types_enum = []
|
||||||
|
|
||||||
|
|
||||||
def purge():
|
def purge():
|
||||||
global products_enum
|
|
||||||
global classes_enum
|
global classes_enum
|
||||||
global types_enum
|
global types_enum
|
||||||
products_enum = []
|
|
||||||
classes_enum = []
|
classes_enum = []
|
||||||
types_enum = []
|
types_enum = []
|
||||||
|
|
||||||
@@ -76,28 +73,10 @@ def refreshPredefinedTypes(self, context):
|
|||||||
context.scene.BIMRootProperties.ifc_predefined_type = enum[0][0]
|
context.scene.BIMRootProperties.ifc_predefined_type = enum[0][0]
|
||||||
|
|
||||||
|
|
||||||
def getIfcProducts(self, context):
|
def get_ifc_products(self, context):
|
||||||
global products_enum
|
if not IfcClassData.is_loaded:
|
||||||
file = IfcStore.get_file()
|
IfcClassData.load()
|
||||||
if len(products_enum) < 1:
|
return IfcClassData.data["ifc_products"]
|
||||||
products_enum.extend(
|
|
||||||
[
|
|
||||||
(e, e, "")
|
|
||||||
for e in [
|
|
||||||
"IfcElement",
|
|
||||||
"IfcElementType",
|
|
||||||
"IfcSpatialElement",
|
|
||||||
"IfcGroup",
|
|
||||||
"IfcStructuralItem",
|
|
||||||
"IfcContext",
|
|
||||||
"IfcAnnotation",
|
|
||||||
"IfcRelSpaceBoundary",
|
|
||||||
]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
if file.schema == "IFC2X3":
|
|
||||||
products_enum[2] = ("IfcSpatialStructureElement", "IfcSpatialStructureElement", "")
|
|
||||||
return products_enum
|
|
||||||
|
|
||||||
|
|
||||||
def getIfcClasses(self, context):
|
def getIfcClasses(self, context):
|
||||||
@@ -118,7 +97,7 @@ def get_contexts(self, context):
|
|||||||
|
|
||||||
class BIMRootProperties(PropertyGroup):
|
class BIMRootProperties(PropertyGroup):
|
||||||
contexts: EnumProperty(items=get_contexts, name="Contexts")
|
contexts: EnumProperty(items=get_contexts, name="Contexts")
|
||||||
ifc_product: EnumProperty(items=getIfcProducts, name="Products", update=refreshClasses)
|
ifc_product: EnumProperty(items=get_ifc_products, name="Products", update=refreshClasses)
|
||||||
ifc_class: EnumProperty(items=getIfcClasses, name="Class", update=refreshPredefinedTypes)
|
ifc_class: EnumProperty(items=getIfcClasses, name="Class", update=refreshPredefinedTypes)
|
||||||
ifc_predefined_type: EnumProperty(items=getIfcPredefinedTypes, name="Predefined Type", default=None)
|
ifc_predefined_type: EnumProperty(items=getIfcPredefinedTypes, name="Predefined Type", default=None)
|
||||||
ifc_userdefined_type: StringProperty(name="Userdefined Type")
|
ifc_userdefined_type: StringProperty(name="Userdefined Type")
|
||||||
|
|||||||
Reference in New Issue
Block a user