Minor fixes for loading schema data. See #1222.

This commit is contained in:
Dion Moult
2021-01-27 09:14:47 +11:00
parent b71febab0d
commit 572efd7ea6
3 changed files with 8 additions and 1 deletions
@@ -187,6 +187,7 @@ if bpy is not None:
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
bpy.app.handlers.load_post.remove(prop.setDefaultProperties)
bpy.app.handlers.load_post.remove(prop.clearIfcStore)
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
del bpy.types.Scene.BIMProperties
@@ -149,7 +149,12 @@ class Data:
enum_items = []
if prop_template.TemplateType == "P_SINGLEVALUE":
data_type = str(IfcStore.get_schema().declaration_by_name(prop_template.PrimaryMeasureType or "IfcLabel"))
try:
data_type = str(IfcStore.get_schema().declaration_by_name(prop_template.PrimaryMeasureType or "IfcLabel"))
except:
# TODO: Occurs if the data type is something that exists in IFC4 and not in IFC2X3. To fully fix
# this we need to generate the IFC2X3 pset template definitions.
continue
elif prop_template.TemplateType == "P_ENUMERATEDVALUE":
data_type = "enum"
enum_items = [v.wrappedValue for v in prop_template.Enumerators.EnumerationValues]
@@ -38,6 +38,7 @@ vector_styles_enum = []
@persistent
def clearIfcStore(scene):
IfcStore.file = None
IfcStore.schema = None
@persistent