mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
Solved #3219
This commit is contained in:
@@ -818,10 +818,22 @@ class ExportIFC(bpy.types.Operator):
|
|||||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
json_version: bpy.props.EnumProperty(items=[("4", "4", ""), ("5a", "5a", "")], name="IFC JSON Version")
|
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)
|
json_compact: bpy.props.BoolProperty(name="Export Compact IFCJSON", default=False)
|
||||||
should_save_as: bpy.props.BoolProperty(name="Should Save As", default=False)
|
should_save_as: bpy.props.BoolProperty(name="Should Save As", default=False, options={"HIDDEN"})
|
||||||
use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False)
|
use_relative_path: bpy.props.BoolProperty(name="Use Relative Path", default=False)
|
||||||
|
save_as_invoked: bpy.props.BoolProperty(name="Save As Dialog Was Invoked", default=False, options={"HIDDEN"})
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
layout.prop(self, "json_version")
|
||||||
|
layout.prop(self, "json_compact")
|
||||||
|
if bpy.data.is_saved:
|
||||||
|
layout.prop(self, "use_relative_path")
|
||||||
|
else:
|
||||||
|
layout.label(text="Save the .blend file first ")
|
||||||
|
layout.label(text="to use relative paths for .ifc.")
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
|
self.save_as_invoked = False
|
||||||
if not IfcStore.get_file():
|
if not IfcStore.get_file():
|
||||||
self.report({"ERROR"}, "No IFC project is available for export - create or import a project first.")
|
self.report({"ERROR"}, "No IFC project is available for export - create or import a project first.")
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
@@ -835,13 +847,15 @@ class ExportIFC(bpy.types.Operator):
|
|||||||
self.filepath = Path(bpy.data.filepath).with_suffix(".ifc").__str__()
|
self.filepath = Path(bpy.data.filepath).with_suffix(".ifc").__str__()
|
||||||
else:
|
else:
|
||||||
self.filepath = "untitled.ifc"
|
self.filepath = "untitled.ifc"
|
||||||
|
|
||||||
|
self.save_as_invoked = True
|
||||||
WindowManager = context.window_manager
|
WindowManager = context.window_manager
|
||||||
WindowManager.fileselect_add(self)
|
WindowManager.fileselect_add(self)
|
||||||
return {"RUNNING_MODAL"}
|
return {"RUNNING_MODAL"}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
project_props = context.scene.BIMProjectProperties
|
project_props = context.scene.BIMProjectProperties
|
||||||
if self.should_save_as:
|
if self.save_as_invoked:
|
||||||
project_props.use_relative_project_path = self.use_relative_path
|
project_props.use_relative_project_path = self.use_relative_path
|
||||||
if project_props.should_disable_undo_on_save:
|
if project_props.should_disable_undo_on_save:
|
||||||
old_history_size = tool.Ifc.get().history_size
|
old_history_size = tool.Ifc.get().history_size
|
||||||
|
|||||||
Reference in New Issue
Block a user