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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

January 2022 - Notices, What's New, and Improvements to API

Message 1 of 3
831 Views, 2 Replies

January 2022 - Notices, What's New, and Improvements to API

Warning – Python Version Update Coming

This is a “good news and bad news” kind of warning. The good news is the version of Python being used in Fusion will be updated in the next Fusion release to Python 3.9.7. That's great news because the Python language continues to be enhanced, and we all want to use the newest features. 


The bad part of this announcement is that if you write or use any Python apps delivered as .pyc files, this change will break them. They'll be broken because .pyc files are tied to the version of Python used to create them. Add-ins compiled with the current version (3.7) will not be compatible with the next release (3.9) and will fail to load. This change does not affect any add-ins where the .py source code is available. 


We're currently working with the Autodesk App Store team to determine the impact of this change and develop a plan to minimize the impact on you and our customers. Watch the Fusion 360 API and Scripts forum for a sticky post that will contain the details once we've decided on the best solution.  


Notice – Retiring “Old” Browser 

Some of you may have noticed the new useNewWebBrowser parameter that appeared on the Palettes.add method over a year ago. You can read more about Palettes in the API User Manual, but it is essentially a dialog that hosts a web browser. To support this browser functionality, Fusion has used the CEF component (Chromium Embedded Framework). Fusion is in the process of switching to the Qt Web Browser component to support embedded browsers. While this transition occurs, Fusion is supporting both web browser components.  


The useNewWebBrowser argument currently defaults to False, which means your palette will behave as before and use the CEF browser. Setting the argument to True will cause the palette to use the new QT Web Browser.  

There is currently no confirmed date for this migration, and we will give early notice once a date is confirmed but you are still strongly encouraged to set this argument to True and test your functionality, if you are still using the old browser. When Fusion completes the transition to the QT Web Browser component, support for the CEF browser component will be removed from Fusion, and palettes will always use the QT Web Browser regardless of how the argument is set. 



This is a big release for us, as you can see from the list below. We've worked very hard on some of these items and hope that you get some benefit from these new capabilities and fixes. 


Python Add-In Template 

Previously, when you used the "Scripts and Add-Ins" command to create a new add-in, it created a new add-in, but the resulting code was the bare minimum with just basic run and stop functions. It didn't help write the code that makes an add-in much more powerful than a typical script, which is the ability to handle events and add commands to the user interface. Now, when you create a new add-in, you'll get a complete add-in that contains an implementation of three commands; a basic command and two commands that show the use of palettes. No enhancements were made to the Fusion API itself to support this new template. The template demonstrates how to use the API with Python for an add-in. This new template is only for Python because many of you using Python are new to programming and Python, and this new template provides a framework that will make creating your commands much simpler.  


A new topic has been added to the User Manual that describes the new template and its use. 

We've also updated the Python Spur Gear add-in sample to use the new template and replaced the other Python add-in sample with a new command sample called CommandSample. It has five commands that demonstrate many different capabilities of Fusion commands, including the various command inputs, palettes, and selections. 



Knowing When a DataFile is Completely Saved 

You can save a document to Fusion Team using the Document.saveAs method of the API. When you save a document, either through the user interface or the API, the save operation involves two steps; an immediate local save and then the processing on the cloud to save the DataFile in Fusion Team. The saveAs method returns after the local save has finished but before the processing on the cloud is complete. This is a problem if you need to use the DataFile created when the save operation is complete. For example, if you've created a part and now want to reference it into an assembly. 


Previously, the only solution was to set up a loop within your program and wait until the document.isSaved property returned True. Doing this is a nuisance and could cause problems if the save fails for some reason. There is also the case where you need to know when a user invoked save operation is finished. Some additional functionality has been added to know when the save operation is complete; a new dataFileComplete event has been added to the Application object. This event notifies you when the save is complete for any document, regardless of if you or the user started the save operation. A new isComplete property has also been added to the DataFile object so you can also determine if any DataFile is fully saved. 


Download Non-Fusion Files 

For a long time, the API has supported the ability to upload any file to a folder in your Fusion Team account. Using the API's Data functionality, you can access these files as a DataFile object, but there has not been a way to retrieve them. A new download method has been added to the DataFile object to download the file to a local file. 


Web Browser Component Update 

We've been posting the notice below about the new web browser available within Fusion. We expected that there wouldn't be any differences between the old browser and the new one but wanted you to test your applications with the new browser in case of an unexpected difference. tykapl.breuil reported an issue with getting back the return value from the adsk.fusionSendData function. 

There is different behavior between the old and new browsers when making this call. With the old browser, the fusionSendData call is synchronous, which means that your JavaScript execution is halted while Fusion handles the event and passes back the result. The function's return value is the value that the add-in provided through the returnData property of the HTMLEventArgs object. The fusionSendData call is asynchronous with the new browser, which means the JavaScript code does not wait for the return but continues execution. The return value, in this case, is a "Promise", which results in a JavaScript function being called when the Promise returns. The User Manual topic on Palettes and Browser Command Inputs has been updated to show the use of a Promise. Also, the Palette code in the new Python add-in template and samples demonstrates this. 


Occurrence Transform Problems 

We were surprised to learn about problems with the API when getting the transformation matrix from an occurrence using the Occurrence.transform. This problem has existed for quite a while but wasn't noticed by us or reported until recently by hajime2MRG3. We've chosen not to fix the existing transform property because someone may be expecting the incorrect behavior and fixing it would break their program. Instead, we've added a new transform2 property to the Occurrence object that works as expected when getting and setting the transform of an occurrence. 


Loft Feature Enhancements 

Additional capabilities were added to the Loft Feature commands quite a while ago, but these enhancements have not been available in the API. With this release, the API is caught up with the functionality available in the command UI. The LoftFeatureInput and the LoftFeature objects now support the isClosed and isTangentEdgesMerged properties to provide the additional control. 


Code Hint Improvements 

Changes have been made to the files that Visual Studio Code uses for code hints that have improved both when code hints are shown, and the information provided. 



  • Sketch.offset could cause Fusion 360 to crash if it was given a specific type of invalid input through the API.  Specifically, if you attempted to provide Sketch geometry from a different sketch.  The issue was identified and is now handled through a proper exception. 
  • When you used a ValueInput created using the createByString method to create a feature, there was a problem. The ValueInput is used to define the value of a parameter that will control the feature or sketch dimension. The problem was the string was being evaluated, and the created parameter was the value. Instead, it should be the expression that was defined by the string. For example, if the string was "Length / 2", you want the created parameter to have that expression, not the current result of Length divided by 2. The expression is now used. 
  • m0d0 reported a problem with entity tokens were creating an entity token for a non-root component and then binding back; an occurrence is returned instead of the component. It now works as it should. 
  • For a long time, there has been a problem where the help button on the command dialog of an API-created command didn't work on Mac. The cause of the problem was finally discovered and corrected. 


Keqing Song
Autodesk Fusion Community Manager
Portland, Oregon, USA

Become an Autodesk Fusion Insider

Message 2 of 3
in reply to: keqingsong

Hi @keqingsong .


Will the switch to Python 3.9.7 be in the January 2022 Update or in the February 2022 Update?


The interpretation changes when I read the text before the January 2022 Update and when I read it after the Update.
(Also queried by Insider)

Message 3 of 3
in reply to: keqingsong

Python 3.9.7 change is not part of this update. It will come in future updates. Stay tuned for further announcements. 

Keqing Song
Autodesk Fusion Community Manager
Portland, Oregon, USA

Become an Autodesk Fusion Insider

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