From 9316e0bff04a14580358d810fc69d9f51258b85e Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 2 Apr 2025 12:41:57 +0500 Subject: [PATCH] Skip loading linked models in the drawing if they're unloaded #6403 As it's probably unintuitive (user can't see the linked model in viewport but we still load it) and user then have no option to keep model in Links but keep it unloaded. Also producing traceback below if linked file is missing. ``` Error: Python: Traceback (most recent call last): File "\bonsai\bim\module\drawing\operator.py", line 299, in execute linework_svg = self.generate_linework(context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\bonsai\bim\module\drawing\operator.py", line 828, in generate_linework IfcStore.session_files[link.name] = ifcopenshell.open(link.name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\ifcopenshell\__init__.py", line 162, in open raise FileNotFoundError(f"File does not exist: '{path}'.") FileNotFoundError: File does not exist: 'D:\Dropbox\GitLab\OD_Library\BIM\OD_Revit_Template - 2020 - IFC4 - Reference View.ifc'. ``` --- src/bonsai/bonsai/bim/module/drawing/operator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 56a59506d0..14acb7dcb3 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -824,6 +824,8 @@ class CreateDrawing(bpy.types.Operator): props = tool.Project.get_project_props() for link in props.links: + if not link.is_loaded: + continue if link.name not in IfcStore.session_files: IfcStore.session_files[link.name] = ifcopenshell.open(link.name) files[link.name] = IfcStore.session_files[link.name]