When you go to the right view and run this python code, how do you get the Cplane coordinates instead of the World coordinates as it does now?
import Rhino
import rhinoscriptsyntax as rs
def PointCoordinates():
gp = Rhino.Input.Custom.GetPoint()
gp.SetCommandPrompt("Select point")
while True:
gp.ClearCommandOptions()
get_rc = gp.Get()
if gp.CommandResult()!=Rhino.Commands.Result.Success:
return gp.CommandResult()
if get_rc==Rhino.Input.GetResult.Point:
point = gp.Point()
print point
if get_rc == Rhino.Input.GetResult.Cancel:
break
return Rhino.Commands.Result.Success
if __name__ == "__main__":
PointCoordinates()
for me the gp.Point() is in world coordinates, for example here i am picking cPlane(x=10, y=20) but point prints (0, 10, 20) which is the expected result in world coordinates.
Are you seeing something different?
import Rhino
import scriptcontext as sc
def PointCoordinates():
gp = Rhino.Input.Custom.GetPoint()
gp.SetCommandPrompt("Select point")
cPlane = sc.doc.Views.ActiveView.ActiveViewport.ConstructionPlane()
while True:
gp.ClearCommandOptions()
get_rc = gp.Get()
if gp.CommandResult()!=Rhino.Commands.Result.Success:
return gp.CommandResult()
if get_rc==Rhino.Input.GetResult.Point:
point = gp.Point()
print "Picked point in world coordinates: " + str(point)
bSuccess, pointPulled = cPlane.RemapToPlaneSpace(point)
print "Picked point in plane coordinates: " + str(pointPulled)
if get_rc == Rhino.Input.GetResult.Cancel:
break
return Rhino.Commands.Result.Success
if __name__ == "__main__":
PointCoordinates()