Parameters inside a conditional expression

Parameters inside a conditional expression

fusion360JUVTQ
Contributor Contributor
729 Views
5 Replies
Message 1 of 6

Parameters inside a conditional expression

fusion360JUVTQ
Contributor
Contributor

I would like to cut some material off a section on a model. The model has a parameter (mm) called 'Thickness' and a parameter called 'Making' (text). The 'Making' parameter is either 'lid' or 'box'.

What I am trying to achieve is that if 'Making' == 'box' then I want to cut a section off my model.

I am doing an 'extrude' (cut) with the amount to be cut being 'Thickness'/2.

In the extrude 'distance' field I am using the following:

if(Making == 'box';Thickness/2, 0.0001)

This fails because the 'Thickness' parameter doesn't get evaluated. The 'if' statement works fine if the second and third part of the 'if' statement is a number.

How can I convince Fusion to evaluate the second portion of the 'if' expression. If we assume that the 'Thickness' parameter is 12 and the 'Making' parameter is 'box', then the 'if' expression should evaluate as if I had used 

if(Making == 'box';6;0.0001)

I am assuming that I am somehow messing up how the 'if' expression is formatted.

0 Likes
Accepted solutions (1)
730 Views
5 Replies
Replies (5)
Message 2 of 6

TheCADWhisperer
Consultant
Consultant
Accepted solution

@fusion360JUVTQ wrote:

 

This fails because the 'Thickness' parameter doesn't get evaluated. The 'if' statement works fine if the second and third part of the 'if' statement is a number.

How are you canceling out the units of Thickness to have a unitless number?

0 Likes
Message 3 of 6

fusion360JUVTQ
Contributor
Contributor

I am sorry for not being clearer Thickness is (in this example) 12 mm. The expression should evaluate as 12 mm/ 2 which would be 6 mm. I will double check that I didn't mess up units in the expression somehow.

0 Likes
Message 4 of 6

fusion360JUVTQ
Contributor
Contributor

Holy crap, I think you are correct. Fusion inserted '* 1 mm' at the end of my 'If' statement (probably from my trying all kinds of different things) and when I deleted that, Fusion moved the 'mm' from outside of the 'if' expression to the inside making it 

( if(Making == 'box'; Thickness / 2; 0.0001 mm) )

which allowed things to work as intended. Looking things over again, I think I now understand what happened .... the unitless number was in the 'If' expression as the 'false' evaluation result and that screwed up the works.

Thank you!

 

0 Likes
Message 5 of 6

g-andresen
Consultant
Consultant

 

 

post removed

 

 

 

 

günther

0 Likes
Message 6 of 6

fusion360JUVTQ
Contributor
Contributor

In a related note (if I am allowed to tack this on), the third parameter in this 'If' statement is 0.0001 because the statement breaks if I use '0'. The 'If' statement basically cuts a section of the model if the test is evaluated as 'true'. Ideally, there would be no cut at all if the expression evaluates to 'false' but I haven't figured out a way to do that without doing a tiny tiny cut. I do not know a way to only call the extrude if the expression evaluates to 'true'.

0 Likes