Hello,
I see that you can create a new Named Cplane with rs.AddNamedCPlane
but how can you then set it’s origin, x vector and y vector?
Thanks,
Dan
Hello,
I see that you can create a new Named Cplane with rs.AddNamedCPlane
but how can you then set it’s origin, x vector and y vector?
Thanks,
Dan
AddNamedCPlane
is for creating a new named CPlane from an existing view’s CPlane. So it seems like you first would have to set the CPlane in the view you want with ViewCPlane(plane)
and then use AddNamedCPlane()
. You would need to use something like plane=rs.PlaneFromFrame()
or plane=rs.PlaneFromNormal()
to create the plane.
Quickie all-rhinoscriptsyntax code sample:
import rhinoscriptsyntax as rs
origin=[0,0,0]
x_vec=[1,1,0]
y_vec=[-1,1,1]
plane=rs.PlaneFromFrame(origin,x_vec,y_vec)
rs.ViewCPlane(rs.CurrentView(),plane)
rs.AddNamedCPlane("Test_CPlane",rs.CurrentView())
It’s possible perhaps to do it a bit more elegantly with some RhinoCommon…
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
origin=Rhino.Geometry.Point3d(0,0,0)
x_vec=Rhino.Geometry.Vector3d(1,1,0)
y_vec=Rhino.Geometry.Vector3d(-1,1,1)
plane=Rhino.Geometry.Plane(origin,x_vec,y_vec)
sc.doc.NamedConstructionPlanes.Add("Test_CPlane_2", plane)
This adds the named construction plane to the document without actually having to set it in a view.
@Helvetosaur you’re the BOMB!
Thank you.