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?
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.
Or like this using rc:
import Rhino as rc print rc.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.GetCameraFrame()
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()
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.