[Python] Rename exisiting Named View

(Ivo) #1

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

(Ivo) #3

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:


Do you or anyone else have any further suggestions?

(Ivo) #4

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.

(Ivo) #6

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.

(Dale Fugier) #7

Hi @Dow,

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


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

– Dale

(Ivo) #8

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

(Brian Gillespie) #9

RH-52278 is fixed in the latest WIP