mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 22:12:32 +00:00
The predefined type suggestions now fetch their values from the ifcopenshell.util.doc module instead of parsing the file data
This commit is contained in:
@@ -38,7 +38,7 @@ class IfcClassData:
|
|||||||
cls.data = {}
|
cls.data = {}
|
||||||
cls.data["ifc_products"] = cls.ifc_products()
|
cls.data["ifc_products"] = cls.ifc_products()
|
||||||
cls.data["ifc_classes"] = cls.ifc_classes()
|
cls.data["ifc_classes"] = cls.ifc_classes()
|
||||||
cls.data["ifc_classes_suggestions"] = cls.ifc_classes_suggestions()
|
cls.data["ifc_classes_suggestions"] = cls.ifc_classes_suggestions() # Call AFTER cls.ifc_classes()
|
||||||
cls.data["contexts"] = cls.contexts()
|
cls.data["contexts"] = cls.contexts()
|
||||||
cls.data["has_entity"] = cls.has_entity()
|
cls.data["has_entity"] = cls.has_entity()
|
||||||
cls.data["name"] = cls.name()
|
cls.data["name"] = cls.name()
|
||||||
@@ -117,20 +117,11 @@ class IfcClassData:
|
|||||||
"IfcUnitaryEquipment": ["Fan Coil Unit"],
|
"IfcUnitaryEquipment": ["Fan Coil Unit"],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
file = IfcStore.get_file()
|
version = tool.Ifc.get_schema()
|
||||||
if file:
|
for ifc_class, _, _ in cls.data["ifc_classes"]:
|
||||||
for ifc_class in cls.ifc_classes():
|
class_doc = get_entity_doc(version, ifc_class)
|
||||||
ifc_class = ifc_class[0]
|
predefined_types = class_doc.get("predefined_types", {})
|
||||||
declaration = IfcStore.get_schema().declaration_by_name(ifc_class)
|
suggestions[ifc_class].extend(predefined_types.keys())
|
||||||
for attribute in declaration.attributes():
|
|
||||||
if attribute.name() == "PredefinedType":
|
|
||||||
for e in attribute.type_of_attribute().declared_type().enumeration_items():
|
|
||||||
if e in (
|
|
||||||
"NOTDEFINED",
|
|
||||||
"USERDEFINED",
|
|
||||||
):
|
|
||||||
continue
|
|
||||||
suggestions[ifc_class].append(e.title())
|
|
||||||
return suggestions
|
return suggestions
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user