# Cplane vs World Coordinates

Hi, This seems like a very basic question but for some reason I cannot find the right answer on this forum.

my problem is as follows: I want to draw geometry using rhinoscriptsyntax addpoints() and addpolyline() methods based on a user-defined starting point.

My set-up is as follows:

``````import rhinoscriptsyntax as rs
import Rhino.Geometry as rg

origin = rs.GetPoint("Set Origin")
if origin:
plane = rs.ViewCPlane()
plane = rs.MovePlane(plane,origin)
rs.ViewCPlane(None,plane)

p0 = rs.AddPoint(0, 0, 0)
p1 = rs.AddPoint(2, 0, 0)

``````

But, when the points are drawn, they are drawn based on world plane coordiantes, not on the cplane I just defined. What am I doing wrong :)?

Thanks!

Most scripting works with world coordinates. If you have CPlane coordinates, you need to transform them into world coordinates before inputting them into various drawing methods.

With points, you can use `rs.XformCPlaneToWorld(point, plane)` to transform a point in ‘plane’ coordinates to world coordinates. In this case ‘plane’ would be gotten by `rs.ViewCPlane()`

``````import rhinoscriptsyntax as rs

#make your points in CPlane coordinates
pt1=rs.coerce3dpoint([0,0,0])
pt2=rs.coerce3dpoint([10,0,0])

#get your "from" plane
plane=rs.ViewCPlane()

#transform each point
pt1_cp=rs.XformCPlaneToWorld(pt1,plane)
pt2_cp=rs.XformCPlaneToWorld(pt2,plane)

``````

Otherwise, for objects, this is a two step process, first define the transformation then apply the transformation to the object(s):

``````import rhinoscriptsyntax as rs

#10x10x10 cube's corner points
pt1=rs.coerce3dpoint([0,0,0])
pt2=rs.coerce3dpoint([10,0,0])
pt3=rs.coerce3dpoint([10,10,0])
pt4=rs.coerce3dpoint([0,10,0])
pt5=rs.coerce3dpoint([0,0,10])
pt6=rs.coerce3dpoint([10,0,10])
pt7=rs.coerce3dpoint([10,10,10])
pt8=rs.coerce3dpoint([0,10,10])

#add box in world coordinates

plane=rs.ViewCPlane()

#create your transform - "Rotation1" is plane-to-plane
#rs.XformRotation1(from_plane, to_plane)
xform=rs.XformRotation1(rs.WorldXYPlane(),plane)

#transform the world aligned cube to the active view's CPlane (without copying)
rs.TransformObject(box,xform,False)
``````

Thank you very much for this in-depth explanation! Much appreciated!

I guess it makes more sense then to create geometry at origin and move afterwards if needed, unless for specific cases.

Kind regards,