algorithmic modeling for Rhino
Hello everyone, I am trying to make focus in a component in order to do double click with the script. I don´t know if the command focus is the correct I tried to do a restore view but I couldn't. For now I have this:
import ctypes
import Grasshopper as gh
import time
if Run == True:
SetCursorPos = ctypes.windll.user32.SetCursorPos
mouse_event = ctypes.windll.user32.mouse_event
def left_click(x, y, clicks=1):
SetCursorPos(x, y)
for i in xrange(clicks):
mouse_event(2, 0, 0, 0, 0)
mouse_event(4, 0, 0, 0, 0)
for i in ghenv.Component.OnPingDocument().Objects:
if i.NickName== "Galapagos":
gh.GUI.Canvas.GH_Viewport.Focus(i)
time.sleep(2)
x= int(a/2)
y = int(b/2)
left_click(x,y,2)
Tags:
Hi Miguel
I am sorry but I do not understand what you are trying to do. Could you clarify?
Thanks,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hello,
I am trying to do zoom, focus or restore a named view in the canvas. But I need to do this with a script in order to make a double click in the component that would be centered in the screen. I hope the images clarify what I am trying to do.
I don't know if that is even posible, but I saw there are some commands that probably do that.
Thank you
David R. may be able to tell whether this is possible.
I'm not really clear either. Do you want to hack all mouse-double click events on the Canvas and centre the view on the clicked component?
Sorry for my english, I am going to explain again.
Forget the click event, I just want to restore a view that I saved previously in the canvas, and bring to front the window of grasshopper.
Thank you
PS: I know there is a component named jump, but I need to restore a view with a script.
Finally I could do what I want.
It has some issues, but works. I leave the code inside the file.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by