Get Camera position of saved views

How can I get camera position of two saved views?

I tried this but it does not work as it takes only active view:

private void RunScript(string view0, string view1, object y, ref object A, ref object B)
  {
    Rhino.Display.RhinoView viewport0 = Rhino.RhinoDoc.ActiveDoc.Views.Find(view0, false);
    Rhino.Display.RhinoView viewport1 = Rhino.RhinoDoc.ActiveDoc.Views.Find(view1, false);


    A = viewport0.ActiveViewport.CameraLocation;
    B = viewport1.ActiveViewport.CameraLocation;
  }

SavedView.gh (7.5 KB)
Saveviews.3dm (61.4 KB)

1 Like

Iā€™m not at a computer currently but what if you set the viewport to the named views iterativly and collect the camera locations?

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_Tables_NamedViewTable_Restore_2.htm

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_Tables_NamedViewTable.htm

https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_DocObjects_ViewportInfo_CameraLocation.htm

1 Like

Using
Rhino.DocObjects.Tables.NamedViewTable viewportinfo = Rhino.RhinoDoc.ActiveDoc.NamedViews;

2 Likes

So helpful!! thanks