mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 08:45:22 +00:00
Bonsai - improve error message if ifc file fails to open #5694
This commit is contained in:
@@ -763,8 +763,9 @@ class LoadProject(bpy.types.Operator, IFCFileSelector):
|
|||||||
|
|
||||||
def finish_loading_project(self, context):
|
def finish_loading_project(self, context):
|
||||||
try:
|
try:
|
||||||
|
filepath = self.get_filepath()
|
||||||
if not self.is_existing_ifc_file():
|
if not self.is_existing_ifc_file():
|
||||||
self.report({"ERROR"}, f"Couldn't find IFC file: '{self.get_filepath()}'.")
|
self.report({"ERROR"}, f"Couldn't find IFC file: '{filepath}'.")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
if self.should_start_fresh_session and tool.Blender.is_default_scene():
|
if self.should_start_fresh_session and tool.Blender.is_default_scene():
|
||||||
@@ -775,7 +776,13 @@ class LoadProject(bpy.types.Operator, IFCFileSelector):
|
|||||||
if not self.is_advanced and not self.should_start_fresh_session:
|
if not self.is_advanced and not self.should_start_fresh_session:
|
||||||
bpy.ops.bim.convert_to_blender()
|
bpy.ops.bim.convert_to_blender()
|
||||||
|
|
||||||
context.scene.BIMProperties.ifc_file = self.get_filepath()
|
context.scene.BIMProperties.ifc_file = filepath
|
||||||
|
if not (ifc_file := tool.Ifc.get()):
|
||||||
|
self.report(
|
||||||
|
{"ERROR"},
|
||||||
|
f"Error loading IFC file from filepath '{filepath}'. See logs above in the system console for the details.",
|
||||||
|
)
|
||||||
|
return {"CANCELLED"}
|
||||||
context.scene.BIMProjectProperties.is_loading = True
|
context.scene.BIMProjectProperties.is_loading = True
|
||||||
context.scene.BIMProjectProperties.total_elements = len(tool.Ifc.get().by_type("IfcElement"))
|
context.scene.BIMProjectProperties.total_elements = len(tool.Ifc.get().by_type("IfcElement"))
|
||||||
context.scene.BIMProjectProperties.use_relative_project_path = self.use_relative_path
|
context.scene.BIMProjectProperties.use_relative_project_path = self.use_relative_path
|
||||||
|
|||||||
Reference in New Issue
Block a user