BIM: Make sure we have a default context when exporting to IFC

This commit is contained in:
Yorik van Havre
2025-01-15 11:11:03 +01:00
committed by Chris Hennes
parent f639705762
commit ead1c43de9

View File

@@ -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