Canvas focus on x,y position?

Hello
Is there a way with Ghpython to focus at specific x,y coordinates on the canvas?

I try with this

image

:smile:

1 Like

You need to get and call the method on the active canvas, using a PointF as the argument:

import Grasshopper as gh
from System.Drawing import PointF

gh.Instances.ActiveCanvas.Viewport.Focus(PointF(0,0))
1 Like

Thank you very much
I try with component pivot but when the canvas zoomed in or out focus don’t point at the component

test.gh (3.0 KB)

Solved:

v = gh.Instances.ActiveCanvas.Viewport
gh.GUI.Canvas.GH_Viewport.Zoom.SetValue(v,1)
1 Like