mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Allow selection of max grouping distance in UI
This commit is contained in:
committed by
Dion Moult
parent
ac12a6785c
commit
b407b815e2
@@ -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")
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ class IfcClasher:
|
||||
if element.ObjectPlacement.RelativePlacement.RefDirection:
|
||||
element.ObjectPlacement.RelativePlacement.RefDirection.DirectionRatios = (1.0, 0.0, 0.0)
|
||||
|
||||
def smart_group_clashes(self, clash_sets):
|
||||
def smart_group_clashes(self, clash_sets, max_clustering_distance):
|
||||
count_of_input_clashes = 0
|
||||
count_of_clash_sets = 0
|
||||
count_of_smart_groups = 0
|
||||
@@ -291,7 +291,11 @@ class IfcClasher:
|
||||
|
||||
# INPUTS
|
||||
# set the desired maximum distance between the grouped points
|
||||
max_distance_between_grouped_points = 3
|
||||
if max_clustering_distance > 0:
|
||||
max_distance_between_grouped_points = max_clustering_distance
|
||||
else:
|
||||
max_distance_between_grouped_points = 3
|
||||
|
||||
model = OPTICS(min_samples=2, max_eps=max_distance_between_grouped_points)
|
||||
model.fit_predict(data)
|
||||
pred = model.fit_predict(data)
|
||||
|
||||
Reference in New Issue
Block a user