Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

Help on API command to have outputs reflect updates made to the command inputs using parameters

2way3dtext
Contributor

Help on API command to have outputs reflect updates made to the command inputs using parameters

2way3dtext
Contributor
Contributor

This command creates a pipe along a selected path and a sphere at both ends.

Is there a way to modify the code so that when a set value for the pipe diameter is changed, the diameter of the pipe body (and spheres) also changes automatically?

 

I tried using a parameter to change command inputs. I first created a parameter value and set it equal to 5mm. Then, the parametric value was set as a diameter input for the command. After selecting a path, the command created a pipe with a diameter of 5mm. However, the diameter of the created pipe remained 5mm even after the parameter value was changed to 10mm.

 

May I receive some feedback on a possible solution to this problem?       

0 Likes
Reply
Accepted solutions (1)
613 Views
2 Replies
Replies (2)

kandennti
Mentor
Mentor
Accepted solution

Hi @2way3dtext .

 

We need to associate the user parameters with the sketch dimensions.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-716cfabe-74ff-435e-a3e2-45dc203b8719 

 

I've modified various parts of the code to make the association look like this.

linearDimension.parameter.expression = pipeDiameterIpt.expression

For detailed changes, please compare the attached file with the one you created yourself.

 

 

Also, on a different note, if I do the following in the ExecutePreviewHandler, the Execute event will not be fired.

eventArgs.isValidResult = True

This is commented because it is useless.

1 Like

2way3dtext
Contributor
Contributor

@kandennti

 

Thank you so much for inspecting and revising my code.

 

I searched through the fusion 360 homepage for a solution, but I was unable to find any leads before your reply.

 

Thank you again for your generous time and help.

1 Like