Python GH - Help Understanding IntersectionEvent Class

Hi all,

I am new to scripting (both in GH python, and in general) so I hope this is not a trivial question.

I run into the following lines of code, which computes the intersection points between two curves:

import Rhino.Geometry as rg

pt = []

itxn = rg.Intersect.Intersection.CurveCurve(crv1, crv2, 0.001, 0.001)
for i in itxn:
    _pt = i.PointA
    pt.append(_pt)

I understood that the Intersection.CurveCurve Method returns a IntersectionEvent Class , and that .PointA is a property of that class.

My question is related to the for loop:
I realize that the scope of the loop is that of finding all the intersections, but I struggle to understand - what exactly am I looping through?

Thank you in advance

You’re looping through the items of an instance of a Rhino.Geometry.Intersect.CurveIntersections class, which are instances of the Rhino.Geometry.Intersect.IntersectionEvent class.

The property Rhino.Geometry.Intersect.IntersectionEvent.PointA returns a point on curve A where an intersection has occurred.

1 Like