Is any way to get the screen plane?

Hi;
Is it a plane parallel to the screen ? it is not the cplane For example: In the perspective view, the cplane cant rotate,but I think it will be a plane parallel to the screen always.
How cant I it?

@pythonuser,

you might get the active viewports camera frame like this:

import scriptcontext
vp = scriptcontext.doc.Views.ActiveView.ActiveViewport
rc, plane = vp.GetCameraFrame()
print plane

…then change plane.Origin as you like. Does that help ?

c.

1 Like

Or like this using rc:
import Rhino as rc print rc.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.GetCameraFrame()

1 Like

Think you @clement that is it.

Think you @MarcusStrube.

Hi @clement;
I get this plane to creat a line perpendicular to the screen, but it is not succeed, do you have some suggests?

import scriptcontext as sc
import rhinoscriptsyntax as rs
poi= rs.GetPoint(“pick point”)
poi1=rs.coerce3dpoint(poi)
vp = sc.doc.Views.ActiveView.ActiveViewport
rc, plane = vp.GetCameraFrame()
xf =Rhino.Geometry.Transform.Translation( plane.ZAxis*1000.0);
poi_st = Rhino.Geometry.Point(poi1)
poi_st.Transform(xf)
sc.doc.Objects.AddLine(poi_st,poi1)
sc.doc.Views.Redraw()

@pythonuser,

i’ve just changed Rhino.Geometry.Point to Point3d and created a Rhino.Geometry.Line before adding it. Not sure this is what you want ?

import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
poi= rs.GetPoint("pick point")
poi1=rs.coerce3dpoint(poi)
vp = sc.doc.Views.ActiveView.ActiveViewport
rc, plane = vp.GetCameraFrame()
xf =Rhino.Geometry.Transform.Translation( plane.ZAxis*1000.0);
poi_st = Rhino.Geometry.Point3d(poi1)
poi_st.Transform(xf)
line = Rhino.Geometry.Line(poi_st, poi1)
sc.doc.Objects.AddLine(line)
sc.doc.Views.Redraw()

wouldn’t it be easier to get a point on a line defined by rs.ViewCamera and rs.ViewCameraTarget ?

c.

1 Like

It seams what I need, think you @clement