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

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

2way3dtext
Contributor Contributor
800 Views
2 Replies
Message 1 of 3

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
Accepted solutions (1)
801 Views
2 Replies
Replies (2)
Message 2 of 3

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.

Message 3 of 3

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.