New Script: evaluate logical operators and conditional expressions added to the comment of a Fusion 360 Parameter

New Script: evaluate logical operators and conditional expressions added to the comment of a Fusion 360 Parameter

Bowen.Christopher58NJL
Explorer Explorer
1,331 Views
3 Replies
Message 1 of 4

New Script: evaluate logical operators and conditional expressions added to the comment of a Fusion 360 Parameter

Bowen.Christopher58NJL
Explorer
Explorer

Hi everybody, 

I ran into an issue where I needed to add an if statement to a design parameter. Fusion doesn't currently support this so I made this exploratory python script. Feel free to try it out and help improve it

 

What it does? 

This script adds the ability to evaluate logical operators and conditional expressions added to the comment of a Fusion 360 Parameter.

BowenChristopher58NJL_0-1630616255429.png

 

Example Comment:

if OD_IN >7:; OD_IN = OD_IN;else:; OD_IN=11;

 

Syntax:

Evaluated comments are long one liners so use python syntax , semi colons are replaced with a new line character, indentation needs to stay consistent. Some commands are disallowed.  

 

Want to try it out or contribute? 

Visit https://github.com/bowenchristopher/Fusion360_API/blob/main/Evaluated_Parameter_Comments/Evaluated_P...

 

Note: 

Conditional expressions can also be done with min(max( but this is messy. ex

min(max(( ( ( N1_EA - 5 ) * 1000 ) * 1 in ); 6 in); ID_IN

 

 

 

 

 

1,332 Views
3 Replies
Replies (3)
Message 2 of 4

Bowen.Christopher58NJL
Explorer
Explorer

I put together an Add-in version:

https://github.com/bowenchristopher/Fusion360_API/tree/main/Parameter_Plugin

 

The Add-In will appear in the modify panel of the design workspace. 

BowenChristopher58NJL_1-1631568361476.png

 

Message 3 of 4

terry_fusion
Advocate
Advocate

I think this add-in just may be the thing I'm looking for to truly give Fusion some real parametric design capabilities.

 

Although, I'm not sure how I could use it to define a conditional operation, for example.

 

I have made a fully 'parametric' model template of a shipping crate, something we have to build to ship out our products.

 

The crates change in size depending upon the quantity and size of the product(s).

 

I have populated my start-up file with parameters for our materials, tolerances, and user input values to customize the shipping crate.

 

So in my mind, I see a dialog just like the one you've created that could act as a customized user interface to the parameter table.

 

In this dialog, I would be able to have inputs for length, width, thickness, but also the quantity of specific packaging materials that may or may not always be needed.

 

Everything in my model is based upon the length, width, and quantity of parts.

 

This is where I am running into a brick wall with Fusion, through the parameter table I cannot make binary choices to include or factor out materials.

 

As an example, if I don't want the rigid sheet foam to be represented in the model, there is no way to make it a zero value without breaking the entire model.

 

Also, am not able to create any kind of automated creation based upon user choices.

 

For example, if I make a parameter that calculates the spacing of runners on the top and bottom of a crate, I haven't been able to figure out how to force it to create more based upon the overall length or less based upon spacing, or the overall length dimension.

 

Being able to build in some intelligence into this model would be amazing.

 

Maybe someone else has a better methodology than the one I've been following?

 

Thanks

 

 

Message 4 of 4

bowen.christopherPLHMP
Autodesk
Autodesk

Great idea, that is an excellent parametric model 

Could you set the foam to a dimensionally insignificant value say a the thickness of .0001? 

0 Likes