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: 

Run Fusion Script from Terminal / Command Prompt

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
1681 Views, 3 Replies

Run Fusion Script from Terminal / Command Prompt

Hi! I'm building an application where it would be helpful to run Fusion scripts from the command line or a VSCode window. As part of this project, I would like to retain the ability to write to the I/O console using regular print statements. I would also like to use a GUI with my project, which didn't work for me when I tried running the script directly from Fusion. I have tried the following:

 * Click "Edit" from the Fusion scripting menu. This opens a VSCode window. I can run my Fusion script from that VSCode window, but I cannot launch the GUI, which is implemented with TKinter.

* Copy over the python path, settings.json, and launch.json files from the aforementioned VSCode window to my own project folder, then running my Fusion script from that folder. With this approach, I get some cryptic errors about using the JavaScript API, but my project is entirely in Python.

I can think of some possible approaches to solving this problem:

 * Link the "adsk" packages and my Fusion installation to a normal VSCode window. This would be the optimal solution, since I could open VSCode the normal way and run the Fusion script like I would any other python script. This is also preferred since I could run this from the command line, without even needing to open any files. This would probably involve copying some configuration files, but I'm not sure how to copy over the configuration.

 * Run a GUI from the VSCode window that opens when you click "Edit" from the Fusion360 window. This may involve tampering with the python version that Fusion uses in this window.

 * Have a normal python process (with the GUI and other processing but no calls to the Fusion API) spawn the Fusion python script (which would make calls to the Fusion API).

 

I appreciate any help with this. Please let me know if screenshots or additional information would help. Thanks in advance!

3 REPLIES 3
Message 2 of 4
kandennti
in reply to: Anonymous
Message 3 of 4
Anonymous
in reply to: Anonymous

Thanks for your help! I'll try out some of the tips posted on that thread.

Message 4 of 4
JesusFreke
in reply to: Anonymous

fwiw, it should be possible to use my fusion add-in that I developed for supporting debugging from Intellij IDEA. You could connect to it from a standalone python script and tell it to run a python script in Fusion 360's environment.

 

Sorry, I don't have any sample code for python, although here's the java code in my IDEA plugin that connects to it.

 

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report