How to get the ActiveViewport in C# for grasshopper?

I recently using c# for grasshopper, and troubling with get ActiveViewport. The code that copy online do not work.

1

Hi @Dongao_Wang,

Try this:

  private void RunScript(object x, object y, ref object A)
  {
    var view = RhinoDocument.Views.ActiveView;
    if (null != view)
      A = view.ActiveViewport.Name;
  }

– Dale

1 Like