Using RhinoCommon to get named view of a detail view

Or using Grasshopper (or whatever else :wink: ).

I want to extract the name of a saved view applied to a Detail View. Is it possible? I’d rather also do it while not being inside the detail view.


my guess / did you try:

“detail” = DetailViewObject

→ viewport

→ name

1 Like

Rhinocode / c# scripting in WIP

string name = detail.Viewport.Name;

hope this helps. kind regards -tom

using System;
using System.Diagnostics;
using Rhino.Input;
using Rhino.Commands;
using Rhino.DocObjects;
using Rhino;

const ObjectType filter = Rhino.DocObjects.ObjectType.Detail; 
DetailViewObject detail = null;
ObjRef oref; 
Result result = RhinoGet.GetOneObject("pick",false, filter, out oref );
if (oref == null) return;

detail = oref.Object() as DetailViewObject;
if (detail == null) return;

string name = detail.Viewport.Name;
1 Like

Works beautifully! Thanks so much!!

I’m going to try and make a plugin (someday) that automatically generates a view title. It will pull the view title as well as the scale from the detail view. Getting the scale (might) be easy because there’s already a field for that. We’ll see.

I’ve actually done a plugin for that. Will share it soon.