Added clash manager basic interface to load smart grouped clashes

This commit is contained in:
Vincent Cadoret
2020-11-06 21:14:21 -05:00
committed by Dion Moult
parent f7e05e011a
commit 1921b4cecf
3 changed files with 44 additions and 0 deletions
@@ -143,6 +143,7 @@ if bpy is not None:
operator.SelectClashSource,
operator.ExecuteIfcClash,
operator.SelectIfcClashResults,
operator.SmartClashGroup,
operator.SwitchContext,
operator.RemoveContext,
operator.OpenUpstream,
@@ -319,6 +320,7 @@ if bpy is not None:
ui.BIM_PT_modeling_utilities,
ui.BIM_PT_annotation_utilities,
ui.BIM_PT_qto_utilities,
ui.BIM_PT_clash_manager,
ui.BIM_PT_misc_utilities,
ui.BIM_UL_generic,
ui.BIM_UL_clash_sets,
@@ -1873,7 +1873,36 @@ class SelectIfcClashResults(bpy.types.Operator):
obj.select_set(True)
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):
bl_idname = "bim.select_bcf_file"
bl_label = "Select BCF File"
+13
View File
@@ -2357,6 +2357,19 @@ class BIM_PT_qto_utilities(Panel):
row = layout.row(align=True)
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):
bl_idname = "BIM_PT_misc_utilities"