Fix #2596. Bug with IFC4X3 UI errors as docs couldn't be fetched.

This commit is contained in:
Dion Moult
2023-01-10 12:14:10 +11:00
parent ddc0f7e652
commit 597b2bb0a8
@@ -69,7 +69,7 @@ class IfcClassData:
"IfcAnnotation", "IfcAnnotation",
"IfcRelSpaceBoundary", "IfcRelSpaceBoundary",
] ]
return [(e, e, get_entity_doc(version, e).get("description", "")) for e in products] return [(e, e, (get_entity_doc(version, e) or {}).get("description", "")) for e in products]
@classmethod @classmethod
def ifc_classes(cls): def ifc_classes(cls):
@@ -80,7 +80,7 @@ class IfcClassData:
if ifc_product == "IfcElementType": if ifc_product == "IfcElementType":
names.extend(("IfcDoorStyle", "IfcWindowStyle")) names.extend(("IfcDoorStyle", "IfcWindowStyle"))
version = tool.Ifc.get_schema() version = tool.Ifc.get_schema()
return [(c, c, get_entity_doc(version, c).get("description", "")) for c in sorted(names)] return [(c, c, (get_entity_doc(version, c) or {}).get("description", "")) for c in sorted(names)]
@classmethod @classmethod
def ifc_predefined_types(cls): def ifc_predefined_types(cls):
@@ -92,7 +92,7 @@ class IfcClassData:
if attribute.name() == "PredefinedType": if attribute.name() == "PredefinedType":
types_enum.extend( types_enum.extend(
[ [
(e, e, get_predefined_type_doc(version, ifc_class, e)) (e, e, get_predefined_type_doc(version, ifc_class, e) or "")
for e in attribute.type_of_attribute().declared_type().enumeration_items() for e in attribute.type_of_attribute().declared_type().enumeration_items()
] ]
) )
@@ -120,7 +120,7 @@ class IfcClassData:
) )
version = tool.Ifc.get_schema() version = tool.Ifc.get_schema()
for ifc_class, _, _ in cls.data["ifc_classes"]: for ifc_class, _, _ in cls.data["ifc_classes"]:
class_doc = get_entity_doc(version, ifc_class) class_doc = get_entity_doc(version, ifc_class) or {}
predefined_types = class_doc.get("predefined_types", {}) predefined_types = class_doc.get("predefined_types", {})
suggestions[ifc_class].extend(predefined_types.keys()) suggestions[ifc_class].extend(predefined_types.keys())
return suggestions return suggestions