Looking for rhinoscript-syntax equivalent to _IntersectTwoSets Command

Dear forum members,

I currently working on a script to automize my rhino workflow.

The first part of the script creates multiple polylines and stores them in the array arrChosenLines(i) . The second part creates a set of CutPlanes with multiple AddCutPlane commands. The planes are all saved to the array arrFrames(i).

In the next step i need to create the intersection (points and possibly curves) of these two sets of objects. In the normal workflow i use the command IntersectTwoSets. Because I could not find any rhinoscript-command with the same functionality, I tried the rhino.command(" ") approach. Until now I could not find a working syntax to call this command with my two arrays of objects. I hope somebody can help with this.


Hey there!
If you want to use rhinoscriptsyntax I think you can use this function in the link below which intersects the planes with the curves:
RhinoCommon - curveplaneintersection
I think this will be the proper script:

List Point3d = new List Point3d {PlaneCurveIntersection(arrFrames(i), arrChosenLines(i), tolerance=None)};

I’m a beginner too btw!
Good Luck!

1 Like


thank you for your help. As far as I know your solution works only for a single plane and a single line. I am looking for a command to intersect a set of multiple planes with a set of multiple curves.

Best regards,
M. Josten

You can loop through the list of planes and intersect each plane with the set of curves

Good idea. So I have also to loop through all curves or is there a command to intersect multiple curves with a single plane?

yes you can do so in a nested loop, for example:

import Rhino

for i in range(10):
    pt = Rhino.Geometry.Point3d(0,0,i)
    vec = Rhino.Geometry.Vector3d(0,0,1)
    plane = Rhino.Geometry.Plane(pt, vec)
lines = []
for i in range(20):
    pt0 = Rhino.Geometry.Point3d(0,i,-20)
    pt1 = Rhino.Geometry.Point3d(0,i,20)
    line = Rhino.Geometry.Line(pt0,pt1)

for plane in planes:
    for line in lines:
        print Rhino.Geometry.Intersect.Intersection.LinePlane(line, plane)

You could also hack your way through scripting the IntersectTwoSets command:

import rhinoscriptsyntax as rs

def IntersectTwoSetsHack():
    crvs=rs.GetObjects("Select curves",4,preselect=True)
    if not crvs: return
    srfs=rs.GetObjects("Select surfaces",8,select=True)
    if not srfs: return
    rs.Command("_IntersectTwoSets -_SelGroup {} _Enter".format(temp_group))

However, I recommend doing it the ‘hard’ way with the nested loop, it’s good to learn.

The loop suggestion is a good idea I believe! :thinking: