Greetings,
I use rs.CurveBooleanUnion and check the areas, but this method is very slow. Is there a faster way?
Here’s my script. It takes first one curve, second a list of curves, and checks for overlaps between the first curve and the curves in the list. Returns those that overlap and the ones that don’t in separate lists.
def shape_filter_intersect(curve_bound,shapes):
area1 = rs.Area(curve_bound)
false_shapes = []
true_shapes = []
for shape in shapes:
area2 = rs.Area(shape)
areasum = area1 + area2
areasum=float('%.3f'%(areasum)) #ROUND TO 3 DECIMALS
crvbool = rs.CurveBooleanUnion([curve_bound,shape])
if len(crvbool) != 1:
rs.DeleteObjects(crvbool)
false_shapes.append(shape)
else:
areabool = rs.Area(crvbool)
areabool=float('%.3f'%(areabool)) #ROUND TO 3 DECIMALS
if areabool != areasum: # if not equal
rs.DeleteObjects(crvbool)
false_shapes.append(shape)
else:
rs.DeleteObjects(crvbool)
true_shapes.append(shape)
return false_shapes, true_shapes
6 posts - 3 participants