Grasshopper Canvas Named View Shortcut

I find the dropdown menu for the Canvas Named Views not exactly useful in my workflows and would like to set shortcuts to toggle Named Views on the Grasshopper canvas. Could this please be enabled?

Right now I’m using Jump but I find it only really works in a perfect definition where you go back and forth between a few places on the canvas. As soon as I have to zoom in / out or drag elsewhere, I’d have to first set a correct Named View to use Jump the way I set it up. At this point I’m wondering why I’m even using Jump since a few Named Views with a per view dedicated zoom level would be so much more useful.

Is there a way to access Named Views with code?

@andheum could this maybe be a new Metahopper feature?

In the meantime I found this:

GH_NamedView.Name Property (rhino3d.com)

I don’t understand how to retrieve the Named View names unfortunately…

image

import rhinoscriptsyntax as rs
import Grasshopper as gh


ghCanvas = gh.GH_InstanceServer.ActiveCanvas

a=gh.GUI.Canvas.GH_NamedView()


gh.GUI.Canvas.GH_NamedView.SetToViewport(a,ghCanvas)

How can I get the Named Views I set for the GH Canvas (solver, reference, input) and set one of these Named Views with python?

@gankeyu maybe?

I haven’t dug into this issue but try this:

gh.GH_InstanceServer.ActiveCanvas.Document.Properties.ViewList

2 Likes

Thank you so much. This works.

What would need to be added to the line of code above to get the actual names of the Named Views?

Maybe something like this:

nv = gh.GH_InstanceServer.ActiveCanvas.Document.Properties.ViewList

for i in nv:
    print i.Name
1 Like

Thank you

gh_named_view.gh (11.9 KB)

1 Like