mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 18:22:30 +00:00
Added clash manager basic interface to load smart grouped clashes
This commit is contained in:
committed by
Dion Moult
parent
f7e05e011a
commit
1921b4cecf
@@ -143,6 +143,7 @@ if bpy is not None:
|
|||||||
operator.SelectClashSource,
|
operator.SelectClashSource,
|
||||||
operator.ExecuteIfcClash,
|
operator.ExecuteIfcClash,
|
||||||
operator.SelectIfcClashResults,
|
operator.SelectIfcClashResults,
|
||||||
|
operator.SmartClashGroup,
|
||||||
operator.SwitchContext,
|
operator.SwitchContext,
|
||||||
operator.RemoveContext,
|
operator.RemoveContext,
|
||||||
operator.OpenUpstream,
|
operator.OpenUpstream,
|
||||||
@@ -319,6 +320,7 @@ if bpy is not None:
|
|||||||
ui.BIM_PT_modeling_utilities,
|
ui.BIM_PT_modeling_utilities,
|
||||||
ui.BIM_PT_annotation_utilities,
|
ui.BIM_PT_annotation_utilities,
|
||||||
ui.BIM_PT_qto_utilities,
|
ui.BIM_PT_qto_utilities,
|
||||||
|
ui.BIM_PT_clash_manager,
|
||||||
ui.BIM_PT_misc_utilities,
|
ui.BIM_PT_misc_utilities,
|
||||||
ui.BIM_UL_generic,
|
ui.BIM_UL_generic,
|
||||||
ui.BIM_UL_clash_sets,
|
ui.BIM_UL_clash_sets,
|
||||||
|
|||||||
@@ -1873,6 +1873,35 @@ class SelectIfcClashResults(bpy.types.Operator):
|
|||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
class SmartClashGroup(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.smart_clash_group"
|
||||||
|
bl_label = "Smart Clash Group"
|
||||||
|
filename_ext = ".json"
|
||||||
|
filepath: bpy.props.StringProperty(subtype="FILE_PATH")
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".json")
|
||||||
|
WindowManager = context.window_manager
|
||||||
|
WindowManager.fileselect_add(self)
|
||||||
|
return {"RUNNING_MODAL"}
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
self.filepath = bpy.path.ensure_ext(self.filepath, ".json")
|
||||||
|
with open(self.filepath) as f:
|
||||||
|
clash_sets = json.load(f)
|
||||||
|
|
||||||
|
for obj in bpy.context.visible_objects:
|
||||||
|
global_id = obj.BIMObjectProperties.attributes.get("GlobalId")
|
||||||
|
if global_id:
|
||||||
|
for smart_groups in clash_sets.values():
|
||||||
|
for smart_group_list in smart_groups:
|
||||||
|
for smart_group, clashes in smart_group_list.items():
|
||||||
|
for id in clashes:
|
||||||
|
if global_id.string_value in id:
|
||||||
|
print("object match: ", global_id)
|
||||||
|
obj.select_set(True)
|
||||||
|
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
class SelectBcfFile(bpy.types.Operator):
|
class SelectBcfFile(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_bcf_file"
|
bl_idname = "bim.select_bcf_file"
|
||||||
|
|||||||
@@ -2357,6 +2357,19 @@ class BIM_PT_qto_utilities(Panel):
|
|||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.operator("bim.calculate_object_volumes")
|
row.operator("bim.calculate_object_volumes")
|
||||||
|
|
||||||
|
class BIM_PT_clash_manager(Panel):
|
||||||
|
bl_idname = "BIM_PT_clash_manager"
|
||||||
|
bl_label = "Clash Manager"
|
||||||
|
bl_space_type = "VIEW_3D"
|
||||||
|
bl_region_type = "UI"
|
||||||
|
bl_category = "BlenderBIM"
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
props = context.scene.BIMProperties
|
||||||
|
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.operator("bim.smart_clash_group")
|
||||||
|
|
||||||
class BIM_PT_misc_utilities(Panel):
|
class BIM_PT_misc_utilities(Panel):
|
||||||
bl_idname = "BIM_PT_misc_utilities"
|
bl_idname = "BIM_PT_misc_utilities"
|
||||||
|
|||||||
Reference in New Issue
Block a user