mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 10:59:17 +00:00
Small changes in default names for saving ifc projects
1) changed first ifc saving handler from save_pre to save_post so that in the situation when you just created with .blend file and started ifc project on save dialog would suggest the same name for the .ifc file and for .blend file (previously it was always suggesting ".ifc" and you had to type it in manually). 2) suggested default ifc project named changed from `<blend_filename>.blend.ifc` to `<blend_filename>.ifc` for simplicity. PS save_pre didn't really work anyway - by the time "save ifc dialog" file was invoked and appeared .blend file was already saved anyway.
This commit is contained in:
@@ -152,7 +152,7 @@ def register():
|
||||
bpy.app.handlers.redo_post.append(handler.redo_post)
|
||||
bpy.app.handlers.load_post.append(handler.setDefaultProperties)
|
||||
bpy.app.handlers.load_post.append(handler.loadIfcStore)
|
||||
bpy.app.handlers.save_pre.append(handler.ensureIfcExported)
|
||||
bpy.app.handlers.save_post.append(handler.ensureIfcExported)
|
||||
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
|
||||
bpy.types.Object.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
|
||||
bpy.types.Material.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
|
||||
@@ -174,7 +174,7 @@ def unregister():
|
||||
bpy.utils.unregister_class(cls)
|
||||
bpy.app.handlers.load_post.remove(handler.setDefaultProperties)
|
||||
bpy.app.handlers.load_post.remove(handler.loadIfcStore)
|
||||
bpy.app.handlers.save_pre.remove(handler.ensureIfcExported)
|
||||
bpy.app.handlers.save_post.remove(handler.ensureIfcExported)
|
||||
del bpy.types.Scene.BIMProperties
|
||||
del bpy.types.Object.BIMObjectProperties
|
||||
del bpy.types.Material.BIMObjectProperties
|
||||
|
||||
@@ -35,6 +35,7 @@ from blenderbim.bim.ifc import IfcStore
|
||||
from blenderbim.bim.ui import IFCFileSelector
|
||||
from blenderbim.bim import import_ifc
|
||||
from blenderbim.bim import export_ifc
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class CreateProject(bpy.types.Operator):
|
||||
@@ -828,7 +829,7 @@ class ExportIFC(bpy.types.Operator):
|
||||
self.filepath = os.path.abspath(os.path.join(bpy.path.abspath("//"), self.filepath))
|
||||
return self.execute(context)
|
||||
if not self.filepath:
|
||||
self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".ifc")
|
||||
self.filepath = Path(bpy.data.filepath).with_suffix(".ifc").__str__()
|
||||
WindowManager = context.window_manager
|
||||
WindowManager.fileselect_add(self)
|
||||
return {"RUNNING_MODAL"}
|
||||
|
||||
Reference in New Issue
Block a user