I write a code to check the overlap of 2 segment in the polyline, but the error is when these 2 segment do not overlap but return true
def find_overlapping_curves(polycurve1, polycurve2, tolerance=0.01):
overlaps =
Cur1=rs.ExplodeCurves(polycurve1,True)
Cur2=rs.ExplodeCurves(polycurve2,True)
for curve1 in Cur1:
rs.SelectObject(curve1)
for curve2 in Cur2:
rs.SelectObject(curve2)
intersection = rg.Intersect.Intersection.CurveCurve(rs.coercecurve(curve1),rs.coercecurve(curve2), tolerance, tolerance)
if intersection:
it=rs.CurveCurveIntersection(curve1,curve2)
if intersection[0].IsOverlap:
overlaps=[curve1, curve2]
Cur1.remove(curve1)
Cur2.remove(curve2)
break
rs.UnselectObject(curve2)
rs.UnselectObject(curve1)
rs.DeleteObjects(Cur1)
rs.DeleteObjects(Cur2)
return overlaps
CHEC.3dm (32.8 KB)
1 post - 1 participant