GH - Set Plane to View

Hi all, does anyone was able to set the plane of a view withing GH. I tried with a basic definition in Python, it works but it freezes grasshopper once completed. I attached the definition, thanks in advance.

import rhinoscriptsyntax as rs

if x :
sc.doc = rc.RhinoDoc.ActiveDoc
rs.Command("_cplane view")
sc.doc = ghdoc

import Rhino
if (reset):
    vp = Rhino.RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport
    origin = vp.CameraTarget
    xDir = vp.CameraX
    yDir = vp.CameraY
    pl = Rhino.Geometry.Plane(origin, xDir, yDir)
private void RunScript(bool reset, ref object A)
  if (!reset) return;
  var vp = RhinoDocument.Views.ActiveView.ActiveViewport;
  var origin = vp.CameraTarget;
  var xDir = vp.CameraX;
  var yDir = vp.CameraY;
  var pl = new Plane(origin, xDir, yDir);
} (4.7 KB)


Thank you!