sure, here’s how you should use the code
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
a = []
b = []
for curve1 in curves:
for curve2 in curves:
if( curve1 != curve2):
itxn = rg.Intersect.Intersection.CurveCurve(curve1, curve2, 0.0001, 0.0001)
#count=getattr(itxn,'Count')
#print(count)
#this is how you should ge the number of itersection
count = itxn.Count
#this is a standard loop in pythin
for i in range(count):
#gets the intersection event
ix = itxn[i]
a.append(ix)
#gets the intersection point - there's more to this
#check https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.intersect.intersectionevent
b.append(ix.PointA)
@Xusheng_Li note: there’s a problem with your outer loop logic, that’s why it returns extra points
use this pattern or similar
for i in range(listLength - 1):
for j in range(i+1, listLength):
#intersect curve[ i ] with curve[ j ]
updating the code above
# this takes intersection of all curves and build geometry around the intersection
# input type: curves - Curve (List Access)
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
a = []
b = []
curveCount = len(curves)
for k in range(curveCount - 1):
for m in range(k+1, curveCount):
curve1 = curves[k]
curve2 = curves[m]
if( curve1 != curve2): #this is redundant now...
itxn = rg.Intersect.Intersection.CurveCurve(curve1, curve2, 0.0001, 0.0001)
#count=getattr(itxn,'Count')
#print(count)
#this is how you should ge the number of itersection
count = itxn.Count
#this is a standard loop in pythin
for i in range(count):
#gets the intersection event
ix = itxn[i]
a.append(ix)
#gets the intersection point - there's more to this
#check https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.intersect.intersectionevent
b.append(ix.PointA)

