Earlier this month, a new version of Fusion 360 was released and it contains a preview of the API (Application Programming Interface) we’ve been working on. It’s rare that any off-the-shelf product will do everything you need it to do in the way you would like it to. Of course this applies to Fusion as well, but now, by writing scripts using the new Fusion API, you can automate repetitive tasks and create new capabilities.
Fusion 360 is a product with broad capability in Form, Function and Fabrication that serves a diverse user base. We are planning on providing solutions for 3 main kinds of API users or personas. First, for the complete novice, who primarily wants the ability to record, tweak and playback macros used to automate common or tedious workflows. (we will target the novice in a future release). Second, for the power user (the target of the current release) who wants to script workflows that the product may not yet provide. And thirdly, for professional developers who want to produce add-ins and compatible apps for Fusion 360 (targeted for a future release).
The API documentation is available on the web along with all of the Fusion product help (shown below). The Fusion 360 API User’s Manual contains overview documents that will help get you started. In addition, there are some sample programs included in the help as well as some that are delivered with Fusion.
To explore the gear generator sample and more, let’s get in to the product. The samples along with all of your scripts are available from the Scripts command in the File menu.
This brings up the Scripts Manager, where you can explore the sample scripts that are installed with Fusion, or create and debug your own scripts. Selecting a script and clicking edit will bring up a code editor named Brackets, which is included with Fusion 360.
Brackets have many nice features like color coding, highlighting and auto-completion, which should be a help to both new and experienced JS users.
Once you are ready to run your script, you can click Run on the Script Manager dialog, or you can click Debug to run your script in debug mode. Stepping through a new script in the debugger is a great way to fully understand the intricacies of how the script is working (or not). Clicking Debug brings up the developer tools window in your default browser; for me this is Chrome.
With the debugger, you can walk through the code line by line, looking at the variables along the way, and follow the execution of the program, so that you can identify and fix any bugs or inefficiencies that may exist in the script.
This release of the API is only a preview, so there’s still a lot that we need to do. However, there is already quite a bit of very useful functionality (as this little blog has attempted to highlight). We are currently working very hard to add Python scripting support as well as a full C++ API for developing addins for future releases.
We would very much like to hear your comments about the API. Please tell us what you think about the current preview release and also what functionality you would like to see exposed next in upcoming releases.
Looking forward to hearing your feedback.
Fusion 360 API Team