Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Keeping a script active

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jgmunoz2
476 Views, 5 Replies

Keeping a script active

Hello everyone,

 

I have a question about what adsk.autoTerminate() capabilities are in a script.

I am working on running a script through an add-in. The script creates a new occurrence with a simple cube. However, right after running the script, the design disappears. I was thinking perhaps this command may help my design stay active for further integrations. 

Tags (1)
5 REPLIES 5
Message 2 of 6
ekinsb
in reply to: jgmunoz2

I'm curious how you're executing a script from an add-in. My only guess is that your somehow starting a script from the execute event of a command and that's terminating your command, which aborts anything that it's done so far.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 6
jgmunoz2
in reply to: ekinsb

Is there ways to stop the termination process for these side scripts, without disconnecting them from the execution event. The execution event is needed to run the code with it's sub-processes. 

Message 4 of 6
ekinsb
in reply to: jgmunoz2

I don't understand what your trying to do.  What do you mean by a "side script" and "disconnecting"?  How are you executing the scripts?


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 5 of 6
jgmunoz2
in reply to: ekinsb

I am working with a friend. And we are importing the script into the add-in with the simple 'import script' line. In our add-in we have CommandCreatedEvent, ExecuteCommandEvent, and InputChangedEvent. We connected the CommandCreatedEvent to the other two events, and added some addBoolValueInput commands to create a GUI with buttons. In the InputChangedEvent we have :

 Capture.PNG

Then outside the InputChangedEvent we have :

def place1():

      try:

           script.run(context)

 

Our script just creates a rectangular sketch. As soon as we run the add-in it does run the script and creates the sketch. However right after it creates it,it disappears but we want it to stay in the design. 

Message 6 of 6
ekinsb
in reply to: jgmunoz2

What you're seeing is a result of how commands work. Whatever you do in events besides the execute event will be aborted.  The command framework is designed to collect a set of input and then create the single final result at execution.  However, we are enhancing the command functionality in the future in a way that I think you might be able to accomplish your desired affect, but not exactly in the same way as you're currently trying to do it.  These new enhancements should be out in the update at the end of May.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report