From 8c9ccfdaae705ed45b6b70de9f947b55563949c8 Mon Sep 17 00:00:00 2001 From: Andrej Date: Fri, 6 Jun 2025 11:17:16 +0500 Subject: [PATCH] Fix #6760 --- src/bonsai/bonsai/bim/module/project/operator.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/project/operator.py b/src/bonsai/bonsai/bim/module/project/operator.py index 07f1f4f6a6..fff277f73f 100644 --- a/src/bonsai/bonsai/bim/module/project/operator.py +++ b/src/bonsai/bonsai/bim/module/project/operator.py @@ -1538,7 +1538,8 @@ class ExportIFC(bpy.types.Operator, ExportHelper): bl_description = "Save active IFC file by the provided filepath." bl_options = {"REGISTER", "UNDO"} filename_ext = ".ifc" - filter_glob: bpy.props.StringProperty(default="*.ifc;*.ifczip;*.ifcxml;*.ifcjson", options={"HIDDEN"}) + supported_filexts = (".ifc", ".ifczip", ".ifcjson") + filter_glob: bpy.props.StringProperty(default=",".join(f"*{ext}" for ext in supported_filexts), options={"HIDDEN"}) json_version: bpy.props.EnumProperty(items=[("4", "4", ""), ("5a", "5a", "")], name="IFC JSON Version") json_compact: bpy.props.BoolProperty(name="Export Compact IFCJSON", default=False) should_save_as: bpy.props.BoolProperty(name="Should Save As", default=False, options={"HIDDEN"}) @@ -1557,7 +1558,7 @@ class ExportIFC(bpy.types.Operator, ExportHelper): layout.separator() layout.label(text="Supported formats for export:") - layout.label(text=".ifc, .ifczip, .ifcjson") + layout.label(text=",".join(self.supported_filexts)) def invoke(self, context, event): if not tool.Ifc.get(): @@ -1572,6 +1573,14 @@ class ExportIFC(bpy.types.Operator, ExportHelper): return ExportHelper.invoke(self, context, event) + def check(self, context): + # ExportHelper is automatically adjusting suffix to `filename_ext`. + filepath = Path(self.filepath) + suffix = filepath.suffix.lower() + if suffix != self.filename_ext and suffix in self.supported_filexts: + self.filename_ext = suffix + return ExportHelper.check(self, context) + def execute(self, context): project_props = tool.Project.get_project_props() project_props.use_relative_project_path = self.use_relative_path