mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-08 17:01:40 +00:00
Fix #6760
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user