Brep|Plane Intersection Python script

Hello, Team

private void RunScript(Brep B, Plane P, out object Curves, out object Points)
{
// Write your logic here
Curve Crv;
Point3d Pts;
Rhino.Geometry.Intersect.Intersection.BrepPlane(B, P, 0.001, out Crv, out Pts);
Curves = Crv;
Points = Pts;
}
This is how we solve Brep|Plane intersection in C# (using Rhinocommon)
It seems trickier to do the same in Python ( I can’t clarify how to assign ‘out Crv’ and ‘out Pts’ arguments in Python.
Can you, please, help me create the correct script in Python? Thanks
pls. see a pic attached

Hi, I don’t have access to Rhino right away but in general, Python accepts a,b=F(var1,var2) syntax, i.e., you can retrieve more than one return values from a function. In many cases, ‘out’ parameters can be retrieved that way.

1 Like

Usually I just do something like this:

insec=Rhino.Geometry.Intersect.Intersection.BrepPlane(brep,split_plane,tol)
if insec and insec[0]:
    if insec[1]:
        #your list of curves (if any) will be insec[1]
        #do something
    if insec[2]:
        #your list of points (if any) will be insec[2]
        #do something
1 Like

Thank You Helvetosaur,
I solved the problem according to mikity_kogekoge’s advice.
I will try ur script as well. :pray: