Hi
I get some GH_Componet in Canvas with Ghpython,Then How to Zoom to one Component in ghCanvas.
import Grasshopper as gh
from System.Drawing import PointF
if focus:
doc = ghenv.Component.OnPingDocument()
for obj in doc.Objects:
if obj.NickName != name: continue
gh.Instances.ActiveCanvas.Viewport.Zoom = 10.0
bound = obj.Attributes.Bounds
gh.Instances.ActiveCanvas.Viewport.MidPoint = PointF(bound.X + bound.Width *0.5, bound.Y + bound.Height * 0.5)
focus.gh (3.8 KB)
6 Likes
非常感谢,very tks