Allow selection of max grouping distance in UI

This commit is contained in:
Vincent Cadoret
2020-11-21 19:17:29 -05:00
committed by Dion Moult
parent ac12a6785c
commit b407b815e2
4 changed files with 12 additions and 4 deletions
@@ -1921,7 +1921,7 @@ class SmartClashGroup(bpy.types.Operator):
# execute the smart grouping
save_path = bpy.path.ensure_ext(bpy.context.scene.BIMProperties.smart_grouped_clashes_path, ".json")
smart_grouped_clashes = ifc_clasher.smart_group_clashes(clash_sets)
smart_grouped_clashes = ifc_clasher.smart_group_clashes(clash_sets, bpy.context.scene.BIMProperties.smart_clash_grouping_max_distance)
# save smart_groups to json
with open(save_path, 'w') as f:
@@ -1965,7 +1965,7 @@ class LoadSmartGroupsForActiveClashSet(bpy.types.Operator):
with open(smart_groups_path) as f:
smart_grouped_clashes = json.load(f)
# Reset the list of smart_clash_groups for the UI
# Reset the list of smart_clash_groups for the UI
bpy.context.scene.BIMProperties.smart_clash_groups.clear()
for clash_set, smart_groups in smart_grouped_clashes.items():
@@ -1527,6 +1527,7 @@ class BIMProperties(PropertyGroup):
active_clash_set_index: IntProperty(name="Active Clash Set Index")
smart_clash_groups: CollectionProperty(name="Smart Clash Groups", type=SmartClashGroup)
active_smart_group_index: IntProperty(name="Active Smart Group Index")
smart_clash_grouping_max_distance: IntProperty(name="Smart Clash Grouping Max Distance", default=3, soft_min=1, soft_max=10)
constraints: CollectionProperty(name="Constraints", type=Constraint)
active_constraint_index: IntProperty(name="Active Constraint Index")
eastings: StringProperty(name="Eastings")
@@ -2389,6 +2389,9 @@ class BIM_PT_clash_manager(Panel):
row.prop(props, "smart_grouped_clashes_path", text="")
op = row.operator("bim.select_smart_grouped_clashes_path", icon="FILE_FOLDER", text="")
row = layout.row(align=True)
row.prop(props, "smart_clash_grouping_max_distance")
row = layout.row(align=True)
row.operator("bim.smart_clash_group")