mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 10:06:47 +00:00
bonsai ifcclash - add separate property for export path
Example - https://i.imgur.com/bCRHx9q.png Needed so it will be easier to rerun ifc clash without providing the same filepath each time.
This commit is contained in:
@@ -205,16 +205,12 @@ class ExecuteIfcClash(bpy.types.Operator):
|
||||
bl_label = "Execute IFC Clash"
|
||||
bl_description = "Execute clash detection and save the information to a .bcf or .json file"
|
||||
filter_glob: bpy.props.StringProperty(default="*.bcf;*.json", options={"HIDDEN"})
|
||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||
filepath: bpy.props.StringProperty(subtype="FILE_PATH", options={"SKIP_SAVE"})
|
||||
|
||||
def invoke(self, context, event):
|
||||
_, extension = os.path.splitext(self.filepath)
|
||||
if extension != ".bcf":
|
||||
self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".json")
|
||||
if extension != ".json":
|
||||
self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".bcf")
|
||||
WindowManager = context.window_manager
|
||||
WindowManager.fileselect_add(self)
|
||||
if self.filepath:
|
||||
return self.execute(context)
|
||||
context.window_manager.fileselect_add(self)
|
||||
return {"RUNNING_MODAL"}
|
||||
|
||||
def execute(self, context):
|
||||
@@ -229,6 +225,7 @@ class ExecuteIfcClash(bpy.types.Operator):
|
||||
if extension != ".json":
|
||||
self.filepath = bpy.path.ensure_ext(self.filepath, ".bcf")
|
||||
|
||||
self.props.export_path = self.filepath
|
||||
settings = ifcclash.ClashSettings()
|
||||
settings.output = self.filepath
|
||||
settings.logger = logging.getLogger("Clash")
|
||||
|
||||
@@ -101,6 +101,11 @@ class BIMClashProperties(PropertyGroup):
|
||||
p1: FloatVectorProperty(name="P1", default=(0.0, 0.0, 0.0), subtype="XYZ")
|
||||
p2: FloatVectorProperty(name="P2", default=(0.0, 0.0, 0.0), subtype="XYZ")
|
||||
active_clash_text: StringProperty(name="Active Clash Text")
|
||||
export_path: StringProperty(
|
||||
name="Export Path",
|
||||
description=".bcf or .json file to export the clash results to",
|
||||
subtype="FILE_PATH",
|
||||
)
|
||||
|
||||
@property
|
||||
def active_clash_set(self):
|
||||
|
||||
@@ -118,8 +118,12 @@ class BIM_PT_ifcclash(Panel):
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, "should_create_clash_snapshots")
|
||||
|
||||
layout.prop(props, "export_path")
|
||||
|
||||
row = layout.row()
|
||||
row.operator("bim.execute_ifc_clash")
|
||||
op = row.operator("bim.execute_ifc_clash")
|
||||
op.filepath = props.export_path
|
||||
|
||||
row = layout.row()
|
||||
row.label(text=f"{len(clash_set.clashes)} Clashes Found", icon="PIVOT_CURSOR")
|
||||
|
||||
Reference in New Issue
Block a user