Planes in Python

Planes

Planes are represented by a Plane structure. Planes can be thought of as a zero-based, one-dimensional list containing four elements: the plane’s origin (point3D), the plane’s X axis direction (vector3d), the plane’s Y axis direction (vector3d), and the plane’s Z axis direction (vector3d).

https://developer.rhino3d.com/images/primer-planedefinition.svg
plane contains (pointOrigin, vectorX, vectorY, vectorZ)

It is easy to forget that there is a specific geometric relationship between the axes. With Planes, the Y axis is automatically oriented 90-degrees to the X axis. The X axis is the only axis that can be easily defined. The Y axis is made orthogonal to the X vector, and the direction of the Z axis is computed from the cross-product of the other two vectors.

Planes can be constructed in a number of ways. One common function is PlaneFromPoints:

import rhinoscriptsyntax as rs

plane = rs.PlaneFromPoints((-2,-5,0),(1,2,0),(-3,3,0))

print(plane.Origin) # origin point
print(plane.XAxis) # x-axis vector
print(plane.YAxis) # y-axis vector

Plane also have a number of properties that can be used to get or set the individual values in the Point object. In the example below the .Origin, .XAxis, .Yaxis, .Zaxis are used.

Planes can also be created using the CreatePlane(), PlaneFromFrame, PlaneFromNormal, and PlaneFromPoints functions.

To change origin of a Plane, simply assign a new value to the .Origin property.

import rhinoscriptsyntax as rs

plane = rs.PlaneFromPoints((-2,-5,0),(1,2,0),(-3,3,0))

print(plane.Origin) # origin point
print(plane.XAxis) # x-axis vector
print(plane.YAxis) # y-axis vector

plane.Origin = rs.CreatePoint(3,4,5) # Changes the origin of the plane.

print(plane.Origin)
print(plane.XAxis) # x-axis vector
print(plane.YAxis) # y-axis vector

RhinoScriptSyntax contains a number of functions to manipulate planes. See Lines and Planes for details.

Also, please see the Python primer Section 8.5 Planes.