Plans


Geometric definition


In the context of Rhino, a plane is similar to “a point with an orientation”. It has a location, no size, but a set of 3 axes: X,Y,Z. This means that to define a plane we not only need to provide a location, but also an orientation.

You will not find a Plane command in the graphical user interface of Rhino, meaning that you cannot draw a plan (much like there is no Vector).

How to add


RhinoCommons


import Rhino

# Parameters to create the plane
origin = Rhino.Geometry.Point3d(1, 1, 1)
normal = Rhino.Geometry.Vector3d(0, 0, 1)

# Will create a plane from an origin and a normal
my_plane = Rhino.Geometry.Plane(origin, normal)


import Rhino

# Parameters to create the plane
origin = Rhino.Geometry.Point3d(1, 1, 1)
point_A = Rhino.Geometry.Point3d(1, 0, 1)
point_B = Rhino.Geometry.Point3d(0, 1, 1)

# Will create a plane from an origin and two points to include in the plane
my_plane = Rhino.Geometry.Plane(origin, point_A, point_B)


import Rhino

# Will create a plane perpendicular to the world Z axis, with (0, 0, 0) as origin
horizontal_plane = Rhino.Geometry.Plane.WorldXY


import Rhino

# Parameters to create the plane
origin = Rhino.Geometry.Point3d(1, 1, 1)
vector_x = Rhino.Geometry.Point3d(1, 0, 0)
vector_y = Rhino.Geometry.Point3d(0, 1, 0)

# Will create a plane from an origin and two vectors
my_plane = Rhino.Geometry.Plane(origin, vector_x, vector_y)

Rhinoscriptsyntax


import rhinoscriptsyntax as rs

# Will create a plane parallel to the global XY plane and with (0, 0, 0) as origin
my_plane = rs.WorldXYPlane()


import rhinoscriptsyntax as rs

# Parameters to create the plane
normal = (2, 3, 4)
origin = (0, 0, 1)

# Will create a plane from an origin and a normal. 
# xaxis=None means that we don't want to redefine a new x axis for the plane: the default value will be used.
my_plane = rs.PlaneFromNormal(origin, normal, xaxis=None)

Main methods and properties


Methods


Among the main methods we have:

# Will calculate the distance between the point "pt1" and the plane "my_plane"
dist = my_plane.DistanceTo(pt1) 

# Will create a point at the local coordinates of the plane u, v, w
u = 1
v = 2
w = 4
point_A = my_plane.PointAt(u, v, w)

# Will flip the Z direction of the plane
my_plane.Flip()

Properties


Among the main properties, we have:

# Will retrieve the normal to the plane
normal = my_plane.Normal

# Will retrieve the origin of the plane
origin = my_point.Origin

🛠 Exercise


Python file:

01: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍

Solution:

01: 🐍⬇️⬇️⬇️ Download the script here ⬇️⬇️⬇️🐍