From ead1c43de9564acefd2d36bf153aa3bfdd49a1b0 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 15 Jan 2025 11:11:03 +0100 Subject: [PATCH] BIM: Make sure we have a default context when exporting to IFC --- src/Mod/BIM/nativeifc/ifc_export.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Mod/BIM/nativeifc/ifc_export.py b/src/Mod/BIM/nativeifc/ifc_export.py index 68c5efbb8d..ba902a11d1 100644 --- a/src/Mod/BIM/nativeifc/ifc_export.py +++ b/src/Mod/BIM/nativeifc/ifc_export.py @@ -127,6 +127,13 @@ def get_export_preferences(ifcfile, preferred_context=None, create=None): best_context = ifc_tools.api_run("context.add_context", ifcfile, context_type = preferred_context[0]) + if not best_context: + if contexts: + best_context = contexts[0] + else: + best_context = ifc_tools.api_run("context.add_context", + ifcfile, + context_type = "Model") return prefs, best_context