CurrentView Fails when switching from Named View

Hi,

I am having problems switching from a Named View to a Perspective View. I’ve pasted sample python code below. The code sucessfully creates a named view called DrawView and set’s it as the current view but fails when I try to switch back to Perspective.

Thanks in advance for the help.

import rhinoscriptsyntax as rs

#Add Named View called “DrawView”
rs.AddNamedView(“DrawView”)
#Set View to DrawView
rs.RestoreNamedView(“DrawView”)
#Set View to Perspective
rs.CurrentView(“Perspective”)
#Check to see if view is Perspective
print(rs.IsView(“Perspective”))

Eric

Hi @eric.bunn,

The rs.CurrentView method sets the current view based on a title (string) you pass to the function. The function then iterates the views looking for a view named “title”.

rs.RestoreNamedView(“DrawView”)

This restores a named view named “DrawView” and renames the view as well. Thus, you no longer have a view named “Perspective”. This is why the subsequent call to rs.CurrentView fails.

Hope this helps.

– Dale