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: 

When running a Python Script, Fusion goes into "Not Responding" mode until the script finishes

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
owendelong
157 Views, 4 Replies

When running a Python Script, Fusion goes into "Not Responding" mode until the script finishes

Despite my script having a progress report that should update every second, and output to the TextCommandPallette, the script will run for several seconds before groups of output and the latest Progress are displayed and the Fusion UI (including the cancel button in the Progress Window) is unresponsive until the script completes.

 

The script creates a sketch and then draws a rectangle and several hundred (maybe upwards of 3000) small line segments and creates a number of "multiline" text objects (which actually only contain 1-2 characters).

 

The eventual intent of the script is to be a generator for DXF files that can be used to laser cut a variety of rulers in wood or acrylic.

 

The code frequently checks for the cancel button being clicked, which I thought should return control to the UI briefly to sample the cancel button at least, but it seems like Fusion is basically stuck in a wait() for the Python script to finish (I don't know if that is what is actually happening).

 

The script is long, but I can post it if people feel it is necessary to identify the problem/solution. I'm hoping someone is already familiar with this behavior and its resolution from the description.

 

 

Tags (2)
4 REPLIES 4
Message 2 of 5
owendelong
in reply to: owendelong

I should add this is on a Mac.

Message 3 of 5
jeff.pek
in reply to: owendelong

If you could post your script, that would be very helpful. In a script that takes significant time to execute, it's important to give Fusion a chance to do its work. Usually, this is done with calls to adsk.doEvents.

 

Jeff

Message 4 of 5
owendelong
in reply to: owendelong

Let me try adding calls to adsk.doEvents and see if that resolves it. If that works, I'll note it in a reply and mark that as an accepted solution. If not, I'll post the script. Thanks!

 

Message 5 of 5
owendelong
in reply to: owendelong

That solved the problem, indeed. This should be included in more of the example code and explained better in the documentation, IMHO.

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