[Python] Rename exisiting Named View

Hi,
New user here, attempting without success to rename an existing Named View.
Focus_Test_2.3dm (680.9 KB)

from   scriptcontext import doc

if __name__ == "__main__":
    for viewInfo in doc.NamedViews:
        print (viewInfo.Name)
        if( viewInfo.Name == "B" ):
            viewInfo.Name = "RENAMED"
            print viewInfo.Name

Can anyone set me on the correct path?

I think you need to modify the RhinoViewport, rather than ViewInfo

Hi dharman,

I’ve read over the RhinoViewport docs and have tried several tests, but have not been successful. I’m trying to modify an existing Named View, not the viewport that the Named View may be restored to. If it were through the GUI, this is where I would make the edit:

Capture

Do you or anyone else have any further suggestions?

Hi @stevebaer
Could you please have a look at this? I would greatly appreciate it.

One possible work around might be to restore the view, save with a new name, then delete the old named view.

I had wanted to avoid that, as I have a user dictionary on each Named View… but perhaps I can copy the user dictionary content over to the new named view. Thank you for the suggestion.

Hi @Dow,

This current is not possible just using RhinoCommon. I’ve logged your wish:

https://mcneel.myjetbrains.com/youtrack/issue/RH-52278

For now, I suggest scripting the _-NamedView _Rname command and option.

– Dale

@dale
Thank you for investigating, logging the feature request, and providing the workaround!

RH-52278 is fixed in the latest WIP