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'.
```
This commit is contained in:
Andrej730
2025-04-02 12:41:57 +05:00
parent bc709f06f7
commit 9316e0bff0
@@ -824,6 +824,8 @@ class CreateDrawing(bpy.types.Operator):
props = tool.Project.get_project_props() props = tool.Project.get_project_props()
for link in props.links: for link in props.links:
if not link.is_loaded:
continue
if link.name not in IfcStore.session_files: if link.name not in IfcStore.session_files:
IfcStore.session_files[link.name] = ifcopenshell.open(link.name) IfcStore.session_files[link.name] = ifcopenshell.open(link.name)
files[link.name] = IfcStore.session_files[link.name] files[link.name] = IfcStore.session_files[link.name]