IF function in Parameters

IF function in Parameters

spi82UU6
Contributor Contributor
584 Views
9 Replies
Message 1 of 10

IF function in Parameters

spi82UU6
Contributor
Contributor

It would be a very good thing if it was possible to use the "IF" function when specifying the values ​​of the parameters. In many cases this would help the work. There are components where, for example, the pattern should be bound to a condition, this is very difficult or not possible at all without the "IF".

0 Likes
Accepted solutions (3)
585 Views
9 Replies
Replies (9)
Message 2 of 10

kacper.suchomski
Mentor
Mentor

Hi

It's possible. You can do it all with iLogic.

iLogic allows both assigning conditional values ​​and linking parameters between files, which is useful e.g. in the above-mentioned patterns.


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 3 of 10

johnsonshiue
Community Manager
Community Manager

Hi! There is a way to write a parametric expression to do "if, then" but it largely depends on the complexity of the condition. Please share an example of the desirable "if, then." I would like to see if there is a parametric expression solution without using an iLogic rule.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 4 of 10

spi82UU6
Contributor
Contributor
Hi,

I need only a simple if/then solution.

A = 10 mm
B = if "A=10" then "B=12" else "B=15"

Or

B = if(A=10;12;15) like in Excel 🙂

That's all.
Have a nice day,
Sandor
0 Likes
Message 5 of 10

kacper.suchomski
Mentor
Mentor
Accepted solution
If A=10 Then
B=12
Else
B=15
End If

You can paste this code into an iLogic rule.

Of course, you must replace the symbols with the actual names of the parameters.


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 6 of 10

aurel_e
Collaborator
Collaborator
Accepted solution

Other users have shown previously creative ways to compensate for that...

In your case the B would be:

( 1 ul - sign(abs(A1 - 10 mm) - 0.001 mm) ) * 12 mm + sign(abs(A1 - 10 mm) - 0.001 mm) * 15 mm

Message 7 of 10

johnsonshiue
Community Manager
Community Manager

Hi! There is a simpler equation to use for this case.

 

B=sign(( A / 1mm - 10 ul )) * 3mm + 12mm

 

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 8 of 10

aurel_e
Collaborator
Collaborator

@johnsonshiue This is resulting 12 for A<10.

Message 9 of 10

SBix26
Consultant
Consultant
Accepted solution

In @johnsonshiue 's equation, just add the absolute value:

 

B=sign(abs( A / 1mm - 10 ul )) * 3mm + 12mm

 

B is 15 unless A is exactly 10.

 

I, too, thought that the sign function would return -1 for negative, 0 for 0, and +1 for positive, but that's not the case; it returns +1 for > 0, 0 for <= 0


Sam B

Inventor Pro 2026.0.1 | Windows 11 Home 24H2
autodesk-expert-elite-member-logo-1line-rgb-black.png

Message 10 of 10

spi82UU6
Contributor
Contributor

Thank you so much!

0 Likes