Hooking into Named Views


#1

Is there a way for us to save information to the named views, as they are created, and restore our settings when they are invoked?


#3

Any news on this topic?


(Dale Fugier) #4

Hi Carsten,

You can store stuff on named views:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var count = doc.NamedViews.Count;
  if (count > 0)
  { 
    var vi = doc.NamedViews[0];
    if (null != vi)
    {
      string value;
      if (vi.Viewport.UserDictionary.TryGetString("cwhimster", out value))
        RhinoApp.WriteLine(value);
      else
      {
        if (vi.Viewport.UserDictionary.Set("cwhimster", "nvidia.com"))
          RhinoApp.WriteLine("Viewport dictionary set successful");
        else
          RhinoApp.WriteLine("Viewport dictionary set failed");
      }
    }
  }
  return Result.Success;
}

The difficulty will be in knowing when one is created and when one is restored, as there are no events to watch for these.

What do you need to store on a named view? More details on what you want to do and why would be helpful - thanks.

– Dale


#5

Hi @dale,

For now we are looking at storing tonemapper and depth of field settings per view.

-c