Curve Curve Intersection in Python for Grasshopper

Hi guys,

I’m a complete novice regarding python but I’m trying to do something “simple” and have been running into a problem.

What I’m trying to do is an iterative “devide by distance” component where you take a curve and a set of distances, and start by creating a circle on one end of the curve, finding the intersection, using it as a center for the next circle and so on until the list is exhausted.

I’m using the rhinoscriptsyntax “CurveCurveIntersection” component but I am unable to retrieve the 1st intersection point. The component supposedly returns a tuple but getting from that to a point is beyond me.

I’m attaching a screenschot, let me know what you think:

Hi @skitsasm,

You might simply things and just call the Curve.DivideEquidistant method, which does what you are tryin to do.

– Dale

It looks like CurveCurveIntersection returns a list of tuples, since there might be multiple intersections. ccx[0] would give you the first tuple (assuming there is at least one intersection) and the second item of that tuple would be a 3d point. So you will need something like:

ccx_list = rs.CurveCurveIntersection(myCircle,myCrv)
if ccx_list: 
    ccx = ccx_list[0] 
    point = ccx[1]
1 Like

Thank you both for your replies,

@sharonjamison your direction worked as it returns a point. Seems like the concept that I missed was the list of tuples and that’s why I couldn’t get all the way “in” to get the point…

@dale thank you as well, that does seem to work just as well!

Thanks again!