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: 

Problem when changing material of component from Fusion 360 API

Message 1 of 4
194 Views, 3 Replies

Problem when changing material of component from Fusion 360 API

I'm developing an Autodesk Fusion AddIn, which allows changing the material of components programmatically.

However, I'm experiencing some problems when actually performing this operation on components that have been moved from their original position, inside an assembly.

For example in this design:


I have 3 copies of a golden component, inside the assembly, which have been moved to 3 different positions.

If I try to change the component material to steel using the following code:


The material correctly changes, but for some reason the position of the three components is reset to the original create position (they are all overlapped in the following image).


Is there something I'm doing wrong or is this an API bug?

This does not happen if I perform the material change manually from the Fusion 360 editor.

Tags (2)
Labels (2)
Message 2 of 4


can you please provide the code necessary for me to be able debug the add-in myself?

I'm short on time (and lazy) to write the add-in to test it on my own to determine if that's issue of the API or there's some mistake in your code. C++ is fine.

Thank you

Message 3 of 4

I don't think assigning a material should cause this since that's not a parametric operation, but your symptom is the same as when you do something in the API that would have caused this dialog to appear.



By default, the positions will be reverted. If you want to keep the position, you'll need to capture their positions before you make the change. You can use the code below. Try adding that to your program before you assign the material and see if that helps.



If you're still having problems, we'll need a simple test case that demonstrates the issue.

Brian Ekins
Inventor and Fusion 360 API Expert
Message 4 of 4

Thank you so much!

Adding the line of code you suggested before the material-changing logic seems to prevent this problem from happening.

I'll mark your suggestion as solution

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

Post to forums  

Technology Administrators

Autodesk Design & Make Report