Lifecycle of a script

Lifecycle of a script

Anonymous
Not applicable
622 Views
2 Replies
Message 1 of 3

Lifecycle of a script

Anonymous
Not applicable

Hello,

I am working on a script that might someday be useable for other people and I wonder how to deploy it. I use python for developing my script. 

 

Currently, I have a main-method and when I run my script, I create my geometry and then my script is done. However, each and everytime I restart my script, spyder asks me whether I want to start a second instance, so obviously my script does not exit although I call 

adsk.terminate() within my script. 

 

I see also that in the example bolt, there is some command pattern that registers a command object, so here the script does not simply run through from top to bottom.

 

Is there any documentation on how this is supposed to work? My goal is to have in the end a button in the user interface that does something.

 

But do I somehow add a button and on each click my scripts is started again or does my script run once but adds the button to the ui itself and then waits for clicks? 

 

0 Likes
Accepted solutions (1)
623 Views
2 Replies
Replies (2)
Message 2 of 3

prainsberry
Autodesk
Autodesk
Accepted solution

THis will all work a little bit better and be a little bit more clear after the next Fusion release in a couple weeks.  At that time we will support "Add-in" development in the API.  THis will allow you to develop a script that loads itself into the UI automatically everytime you start Fusion.  It can have buttons, etc that are placed in the UI to execute tasks.  THe documentation for this should be ready with the release.



Patrick Rainsberry
Developer Advocate, Fusion 360
0 Likes
Message 3 of 3

Anonymous
Not applicable

I am looking forward for the next release to see how the API works. 

0 Likes