How To Trigger Event From Add-In At Regular Time Intervals (Every Second / Minute)?

How To Trigger Event From Add-In At Regular Time Intervals (Every Second / Minute)?

therealsamchaney
Advocate Advocate
701 Views
4 Replies
Message 1 of 5

How To Trigger Event From Add-In At Regular Time Intervals (Every Second / Minute)?

therealsamchaney
Advocate
Advocate

Is it possible through the Fusion 360 API to create an add-in or script that does something at a regular time interval like every second or every minute? I haven't seen anything like that in the examples and I don't know which object or method to look for.

I would love to be able to update things in almost real time. For instance I would like to make a kaleidoscope sketch tool which creates a number of radial mirrors that update continuously to mirror every line or curve you create immediately. 

This would need to not tie up Fusion's GUI, and would need to let the user do things while/between the triggers/updates.

Is something like this possible, and if so, where should I start?

Thanks!
-Sam

0 Likes
Accepted solutions (1)
702 Views
4 Replies
Replies (4)
Message 2 of 5

tykapl.breuil
Advocate
Advocate
Accepted solution

Yes, it is definetely possible, what you would need to do is create a seperate thread running on a loop and using a custom event to make API calls. See this page for more information.

Message 3 of 5

kandennti
Mentor
Mentor
Message 4 of 5

therealsamchaney
Advocate
Advocate
Awesome, thank you. I did not know that Fusion supported multi-threading. This should open up many possibilities for me.
0 Likes
Message 5 of 5

BrianEkins
Mentor
Mentor

Fusion should be considered a single-threaded application. This is entirely true because there are a few things that it will spawn a new thread for some processing but that is the exception. Almost all of Fusion runs within a single thread. This includes the user interface and the API. They all run in the main Fusion thread.  You can do some external processing that doesn't involve Fusion in a separate thread and then for that thread to communicate with your add-in running in the main thread you can use the Custom Event functionality.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes