Thank you @anon39580149. That’s exactly what I needed.
The only thing that isn’t spectacular there is now you need to keep a timer on all the time.
The script was added to this thread see:
You could simplify things by also scripting the GHPython component to update itself (i.e. instead of using a timer and plugins). This function should do it:
import Grasshopper as gh
def updateComponent(interval):
""" Updates this component, similar to using a grasshopper timer """
# Define callback action
def callBack(e):
ghenv.Component.ExpireSolution(False)
# Get grasshopper document
ghDoc = ghenv.Component.OnPingDocument()
# Schedule this component to expire at interval
ghDoc.ScheduleSolution(interval,gh.Kernel.GH_Document.GH_ScheduleDelegate(callBack))
Finally
I see that in other thread but i have 0 knowledge in scripting with grasshopper
I wanted him to search the forum a little bit
That isn’t necessary, the code I posted above should work in the “normal” GHPython scripting component.
Hi,
I don’t quite understand how to apply this script, or rather what its inputs and outputs are.
Do I connect my button component to it? What’s a reasonable interval to simulate a button click (or rather just the release -event)?
Where exactly in my Grasshopper solution do I insert this bit of GHPython?
Thank you in advance.
Here’s a quick example implementing it to trigger a dynamic counter loop (controlling the interval with a slider):
210918_DynamicCounter_GHPython_00.gh (4.1 KB)
Hi Anders!
Thanks for the reply, especially in video form!
Super useful. While it’s not quite what I was looking for now, it’s something else that I have been looking for before!
With regards to the button click in Grasshopper without a double-trigger (press + release events) or freezing RCP:
I resolved to using a boolean toggle with a Metahopper component that resets it immediately back to False upon toggling it to True.
I find it unelegant only because it does not look like a button in the RCP, but at least it works with a single mouse-button press, like a button would.