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: 

API calls from plain python console

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
designingberlin
1057 Views, 4 Replies

API calls from plain python console

I really like the python fusion API, but I don't like spyder - I prefer more powerful text editors (like emacs) and a plain console.

 

Is there a way to run python scripts in a console and access the fusion API?

I guess this will include some importing of libraries and what else ...

 

Thanks,

Stefan

4 REPLIES 4
Message 2 of 5
ekinsb
in reply to: designingberlin

Choosing the "Edit" option in the "Scripts and Add-Ins" dialog will currently always open your program in Spyder.  However you can choose to open the .py file that's on disk using any editor you want. You can edit it and then go back to Fusion to and the "Scripts and Add-Ins" command to run it.  Currently you're required to use Spyder for debugging.  We've discussed the possibility of supporting other editors but the debugging will be difficult.  Ideally, it something we would like to do but I don't know how likely it is to happen.


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

Sure, just using another editor works like you explained. during development when debugging is needed, this may be helpful.

 

Once a workflow is established, it may be a big advantage to not depend on any clicking in the Fusion UI. The python-Fusion process can then be used in automated scripts (not essentially python).

Imagine a 'parameterfile inbox': whenever a new parameterfile arrives in the directory, any script (like a shell script) could call a python script to do something with the data. such as a parameter update on selected designs to generate updated renderings, or just calculate the resulting overall weight to add the value in a testreport ...

 

if such a scenario (API calls initiated by a bash script) currently does not work in python, does it work in javascript or c++?

 

Thanks!

Stefan

Message 4 of 5
ekinsb
in reply to: designingberlin

What you're referring to requires Fusion to be running or if it's not running it will need to be started so it is running and can do whatever work you want it to do.  Fusion doesn't support calling the API from an external process.  I know some people have experimented with creating their own link for communicating between an add-in running in Fusion and some external process but that's outside the scope of the API and they're using whatever capabilities the programming language and the libraries available to it support.

 

I understand what you're saying and agree that it can be a useful workflow for some cases.  Inventor supports this and it is very useful in some workflows but Inventor is Windows based and used the Component Object Model (COM) to expose the API so it essentially gets this for free and it's very easy to use from any language that supports COM.  With Fusion being on Windows and Mac it uses a completely different architecture and many things are just a lot more difficult in a multi-platform environment.  Will it support in the future?  I don't know, but it's not something we're actively working on right now, however we have been adding functionality that wasn't specifically towards supporting this but does potentially make this easier in the future.


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

Thanks for the detailed explanation!

and yes - the current setup is very flexible and allows many things unthinkable before. keep up the good work

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