Construction plane from closed curve profile


Can anybody help me how to create a CPlane from a closed curve in Python?
I would like to click on the profile, define the X axis of the CPlane and draw lines. After I finish the CPlane would jump back to the previous CPlane.


How far have you come so far?

quick n dirty pseudocode:

object = select object
x_line = rs.GetLine()
x_tangent = rs.VectorCreate(x_line[1],x_line[0])

new_cplane = rs.PlaneFromFrame(plane.Origin,x_tangent,plane.YAxis) #tricky and might fail if axes align

current_cplane = rs.ViewCPlane()

do line drawing here



Thanks Willem,

I learnt a lot again. I think the plane.YAxis is not documented. We are not able to use as variable but in arguments is works.

I also have not tried the GetLine and ViewCPlane() yet. The name of ViewCPlane() is a little bit misleading. I thought it sets CPlane to the current view angle. Ha ha…

My solution would have been by Command method to run native Rhino command for CPlane.

– Dale

Thanks Dale,

Does it mean, that we can use all of the properties of certain objects from RhinoCommon in IronPython?


Have a look at these screenshots from the editor.
You can click at the position of the red dot to insert a breakpoint.
This will halt the script at that point and you can inspect the content of the current variables:

More to find on rhinocommon:!

search for plane for example:


A good way to explore working with rhino common in python is to insert breakpoints before a rhinoscript method and the step into the code:

if you click Step Into or F11
you will see what code is executed for rs.ViewCplane():


1 Like

It almost works. The rs.CurvePlane align to the vertical side of the geometry and not the horizontal. The vertical side is also not perpendicular to the horizontal one. I have to use plane.XAxis instead of plane.YAxis.

I need to transform the plane.