Create a parameter that combines two other parameters

Create a parameter that combines two other parameters

StephenCim-001
Advocate Advocate
541 Views
2 Replies
Message 1 of 3

Create a parameter that combines two other parameters

StephenCim-001
Advocate
Advocate

Hi All 

 

Slowly working on my scripts , I have a  script that creates 2 user parameters, parm1  holds radius of a circle and parm2 will hold positive value  , now I need a third user parameter that is = Parm1 + Parm2 .  

 

I can't kind an example online 😞

 

Cheers, Stephen

0 Likes
Accepted solutions (1)
542 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

Here's a simple example that creates two parameters and a third that adds the first two together.

app = adsk.core.Application.get()
des = adsk.fusion.Design.cast(app.activeProduct)
userParams = des.userParameters
userParams.add('angle1', adsk.core.ValueInput.createByReal(math.pi), 'deg', '')
userParams.add('angle2', adsk.core.ValueInput.createByReal(math.pi/2), 'deg', '')
userParams.add('angle1And2', adsk.core.ValueInput.createByString('angle1 + angle2'), 'deg', '')
---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3

StephenCim-001
Advocate
Advocate

Shinny, use what I needed 🙂

0 Likes