There are suprisingly many combinations between geometry types.

For some combinations, functions to compute intersections between those combinations are provided.

In the GhPython environment, you can find such functions in the following places.

- rs.IntersectFooBar()
- rs.FooBarIntersection()
- Rhino.Geometry.Intersect.FooBarIntersection()
- Rhino.Geometry.Intersect.Intersection.FooBar()

## 1 Line and Line

Input: two lines (lineA,lineB)

Output: two points (PA,PB)

import rhinoscriptsyntax as rs (PA,PB)=rs.LineLineIntersection(lineA,lineB)

It is very important that the returned PA and PB are not identical.

You have to check whether they are identical by rs.PointCompare(PA,PB). This returns True if the distance between the two points are smaller than tolerance.

## 2. Line and Plane

import rhinoscriptsyntax as rs P=rs.LinePlaneIntersection(rs.PolylineVertices(lineA),plane)

## 3. Plane and Plane

Two points that gives the start and end points of a line will be returned.

import rhinoscriptsyntax as rs (PA,PB)=rs.PlanePlaneIntersection(planeA,planeB) a=rs.AddLine(PA-(PB-PA)*10,PB+(PB-PA)*10)

## 4. Three Planes

import rhinoscriptsyntax as rs a=rs.IntersectPlanes(planeA,planeB,planeC)

## 5. Creating a quadrilateral by five planes

import rhinoscriptsyntax as rs import Rhino.Geometry.Intersect.Intersection as rgII a=list() planeO=rs.PlaneFromFrame((0,30,3),(1,0,-0.2),(0,1,0)) planeA=rs.PlaneFromFrame((-5,0+30,0),(8,5,0),(0,0,5)) planeB=rs.PlaneFromFrame((-5,0+30,0),(8,-5,0),(0,0,5)) planeC=rs.PlaneFromFrame((5,0+30,0),(8,5,0),(0,0,5)) planeD=rs.PlaneFromFrame((5,0+30,0),(8,-5,0),(0,0,5)) a.append(planeA) a.append(planeB) a.append(planeC) a.append(planeD) points=list() P1=rs.IntersectPlanes(planeO,planeA,planeB) points.append(P1) P2=rs.IntersectPlanes(planeO,planeB,planeC) points.append(P2) P3=rs.IntersectPlanes(planeO,planeC,planeD) points.append(P3) P4=rs.IntersectPlanes(planeO,planeD,planeA) points.append(P4) lines=list() lines.append(rs.AddLine(P1,P2)) lines.append(rs.AddLine(P2,P3)) lines.append(rs.AddLine(P3,P4)) lines.append(rs.AddLine(P4,P1))

## 6. Line and Mesh

For some combinations, we have to use Rhino.Geometry.

If you use Rhino.Geometry, the geometry types should be specified through Type Hint.

input: a Line (lineA)

input: a Mesh (mesh)

** Be sure to select Line and Mesh in the Type Hint menu. **

Four points are input to the ConMesh component.

T{0;1;2} and T{2;3;0} are input to F fo the ConMesh.

Perhaps you can use MeshTriangle component instead.

import rhinoscriptsyntax as rs import Rhino.Geometry.Intersect.Intersection as rgII (pp,nn)=rgII.MeshLine(mesh,lineA) a=list() vertices=mesh.Vertices for i in range(len(pp)): face=mesh.Faces[nn[i]] A=vertices[face.A] B=vertices[face.B] C=vertices[face.C] a.append(rs.AddLine(pp[i],A)) a.append(rs.AddLine(pp[i],B)) a.append(rs.AddLine(pp[i],C))

## 7. Surface and surface

A curve will be returned.

Because we use Rhino.Geometry, we have to select Surface for the inputs in the Type Hint menu.

import rhinoscriptsyntax as rs import Rhino.Geometry.Intersect.Intersection as rgII (flag,curves,points)=rgII.SurfaceSurface(sA,sB,0.00001) a=curves[0]

## 8. Plane and surface

A curve will be returned.

Because SurfacePlane is not provided, we have to use BrepPlane instead.

If you input a surface to S but specify the geometry type as Brep, the surface is automatically converted to a Brep.

import rhinoscriptsyntax as rs import Rhino.Geometry.Intersect.Intersection as rgII N=14 a=list() section=list() for i in range(N+1): newPlane=rs.MovePlane(plane,start+(end-start)*i/N) a.append(newPlane) (flag,curve,P)=rgII.BrepPlane(S,newPlane,0.0001) section.append(curve[0])