I began working off of the “Group points by Cluster” post, grouping my points based off their proximity worked great. However, I have begun grouping my points beforehand by what clash detection group they belonged to.
My ultimate end goal is to be able to group my clash points by test > by element id > by proximity, but right now I just want to be able to group them by proximity.
This is the Python Script I have been using:
#Copyright(c) 2015, Konrad Sobon
# @arch_laboratory, http://archi-lab.net
#join/group curves
# Changed to work with points by Einar Raknes, 2016
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
def groupPoints(point_list,ignore_distance):
grouped_points = [] #A list that contains point groups
queue = set() #A queue set (contains only unique items)
while point_list:
point_group = [] #A list that contains points that are within the ignore_distance
queue.add(point_list.pop()) # Move the last point from the point_list to our queue
while queue:
current_point = queue.pop() #Get the last item in the queue and remove it from the queue.
point_group.append(current_point) #Add the current point to the point_group
for potential_match in point_list:
distance = current_point.DistanceTo(potential_match)
if distance <= ignore_distance:
queue.add(potential_match)
point_list = [item for item in point_list if item not in queue] #removes points in queue from point_list
grouped_points.append(point_group)
return grouped_points
OUT = groupPoints(IN[0],IN[1])
Excel Reader Create Points to SORT5.dyn (187.0 KB)CLASHFILEALL2.xlsx (16.3 KB)