IGH GOO problem intersecting planes

I use GH and Python Scripting for intersecting planes.

If planes are created directly from points and vectors, it works perfectly:

Snippet 1:


import Rhino.Geometry as rg
from System.IO import File

A=rg.Plane(rg.Point3d(0,x,0),rg.Vector3d(1,y,y))
B=rg.Plane(rg.Point3d(0,x,0),rg.Vector3d(0,0,1))
C=rg.Intersect.Intersection.PlanePlane(A,B)


If planes are previously obtained by the method FitPlane, it does not work. It seems there is a problem with the IGH GOO wrapping.

Snippet 2:


import Rhino.Geometry as rg
from System.IO import File

texts1 = File.ReadAllLines(r"C:\Part1.txt")
points1 =
texts2 = File.ReadAllLines(r"C:\Part2.txt")
points2 =

for text in texts1:
subtexts1 = text.split(’ ')
points1.append(rg.Point3d(float(subtexts1[0]), float(subtexts1[1]), float(subtexts1[2])))

for text in texts2:
subtexts2 = text.split(’ ')
points2.append(rg.Point3d(float(subtexts2[0]), float(subtexts2[1]), float(subtexts2[2])))

fitPlane1=rg.Plane.FitPlaneToPoints(points1)
oFit1=fitPlane1

fitPlane2=rg.Plane.FitPlaneToPoints(points2)
oFit2=fitPlane2

int12=rg.Intersect.Intersection.PlanePlane(oFit1,oFit1)-------------------CRASH

EXPECTED PLANE GOT TUPLE


SOLVED

The method FitPlaneToPoints actually returns a tuple. And the plane is stored at index 1 of this tuple.

Just print out “fitPlane1” and you can see that it is a tuple of 3 elements, the 1st element (index 1) is the plane that you want.

a tuple ???

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Plane_FitPlaneToPoints_1.htm

Hi Peter.

I know it seems weird but that the FittoPlane method

the return is a tuple (Succes,Plane). I extracted the plane from this tuple (position [1]) and it worked well

Indeed … since SDK states that we are talking about an enum