mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 21:53:40 +00:00
New IFC authoring mode - when enabled, exporting the IFC auto saves the Blender file too. See #1360.
This commit is contained in:
@@ -40,6 +40,8 @@ class IfcExporter:
|
|||||||
jsonData = ifcjson.IFC2JSON5a(self.file, self.ifc_export_settings.json_compact).spf2Json()
|
jsonData = ifcjson.IFC2JSON5a(self.file, self.ifc_export_settings.json_compact).spf2Json()
|
||||||
with open(self.ifc_export_settings.output_file, "w") as outfile:
|
with open(self.ifc_export_settings.output_file, "w") as outfile:
|
||||||
json.dump(jsonData, outfile, indent=None if self.ifc_export_settings.json_compact else 4)
|
json.dump(jsonData, outfile, indent=None if self.ifc_export_settings.json_compact else 4)
|
||||||
|
if bpy.context.scene.BIMProjectProperties.is_authoring:
|
||||||
|
bpy.ops.wm.save_mainfile()
|
||||||
|
|
||||||
def set_header(self):
|
def set_header(self):
|
||||||
# TODO: add all metadata, pending bug #747
|
# TODO: add all metadata, pending bug #747
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from . import ui, operator
|
from . import ui, prop, operator
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
operator.CreateProject,
|
operator.CreateProject,
|
||||||
operator.ValidateIfcFile,
|
operator.ValidateIfcFile,
|
||||||
|
prop.BIMProjectProperties,
|
||||||
ui.BIM_PT_project,
|
ui.BIM_PT_project,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
pass
|
bpy.types.Scene.BIMProjectProperties = bpy.props.PointerProperty(type=prop.BIMProjectProperties)
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
pass
|
del bpy.types.Scene.BIMProjectProperties
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import bpy
|
||||||
|
from bpy.types import PropertyGroup
|
||||||
|
from bpy.props import (
|
||||||
|
PointerProperty,
|
||||||
|
StringProperty,
|
||||||
|
EnumProperty,
|
||||||
|
BoolProperty,
|
||||||
|
IntProperty,
|
||||||
|
FloatProperty,
|
||||||
|
FloatVectorProperty,
|
||||||
|
CollectionProperty,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class BIMProjectProperties(PropertyGroup):
|
||||||
|
is_authoring: BoolProperty(name="Enable Authoring Mode")
|
||||||
@@ -22,11 +22,13 @@ class BIM_PT_project(Panel):
|
|||||||
|
|
||||||
def draw_project_ui(self, context):
|
def draw_project_ui(self, context):
|
||||||
props = context.scene.BIMProperties
|
props = context.scene.BIMProperties
|
||||||
|
pprops = context.scene.BIMProjectProperties
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="IFC Filename", icon="FILE")
|
row.label(text="IFC Filename", icon="FILE")
|
||||||
row.label(text=os.path.basename(props.ifc_file) or "No File Found")
|
row.label(text=os.path.basename(props.ifc_file) or "No File Found")
|
||||||
|
|
||||||
if IfcStore.get_file():
|
if IfcStore.get_file():
|
||||||
|
row.prop(pprops, "is_authoring", icon="GREASEPENCIL", text="")
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text="IFC Schema", icon="FILE_CACHE")
|
row.label(text="IFC Schema", icon="FILE_CACHE")
|
||||||
row.label(text=IfcStore.get_file().schema)
|
row.label(text=IfcStore.get_file().schema)
|
||||||
|
|||||||
Reference in New Issue
Block a user