To iLogic or not to iLogic – If….then….end if

Share on email
Share on linkedin
Share on facebook
Share on whatsapp

When using iLogic you want to make sure your sketch and model behave as you intended it to. You need to make sure the sketch doesn’t “break” by being fully constrained.

Just remember that, if you cannot make the changes in your model with the normal Inventor by flexing the model (changing parameters and seeing that the model stays intact), it will not work in iLogic.

To get started, let’s open the iLogic browser. You can find this under the manage ribbon in the iLogic panel.

iLogic Browser in Inventor

The browser can either float on your screen or be docked. It is your personal choice.

iLogic Browser Position - A iLogic Browser Position - B

At the top you will see the name of the part with the part symbol next to it. Right click on the name and click on Add Rule.Add iLogic Rule

For the rule try and give it a description that depicts what it is going to do.Naming an iLogic Rule

When you are working out your iLogic code it is a good idea to write what you are trying to achieve out in full. This will help with what code to use and also trouble shooting if the code does not work.

I am going to make the table top work in the following way.


1000 600 Pine
1200 800 Pine
1400 1000 Wood (Cherry)
1600 1200 Wood (Cherry)
1800 1400 Wood Birch
2000 1400 Wood Birch

The 1400 mm and 1600 mm length should have a chamfer on the corners.
The 1800 mm and 2000 mm length should have a fillet on the corners.
So how do I achieve this? By using the “If…then…end if” statement.
By clicking on the If…Then…End If button, iLogic puts a statement down. We will be replacing “My_Expression” with our user parameters that we created.

iLogic My_Expression

This is what the code looks like:

iLogic If_Then Coding

The next command I will use is a snippet from the left hand side column. Snippets are very useful as by using this, we do not have to remember what to type in when trying to perform iLogic code. If you are doing something that is not in the standard snippets you can also save it as a custom snippet and share it between projects.

Using the ‘Features – IsActive’ command will suppress or unsuppress a feature.

If you right click on a feature you can Capture Current State.

Capture Current State Feature

Which gives you this. (This is a nice and quick way to get the state of features in a model.)

Feature IsActice State

So the coding will look like the following, a combination of If…Then…End if, as well as a snippet for feature suppression. (I also edited the ‘Capture Current State’ by deleting ‘***Fillet1*** and d5 = 250 mm just to tidy up a bit.)

If_Then_End with Snippet

For the material we are going to use the material snippet from iProperties.


The code will look like the following:

iProperties Material

So now we have 3 rules.

iLogic Rules

Opening the parameters dialog box and by only changing the Length, we get the following 3 scenarios.

Scenario 1:
Change Length to 1000 mm. Width automatically changes to 600 mm and both Fillet and Chamfer are suppressed. Material changes to Pine.

Scenario 1

Scenario 2:
Change Length to 1400 mm. Width automatically changes to 1000 mm and only Fillet is suppressed. Material changes to Wood (Cherry).

Scenario 2

Scenario 3:
Change Length to 1800 mm. Width automatically changes to 1400 mm and only Chamfer is suppressed. Material changes to Wood (Birch).

Scenario 3

When working with iLogic, try not to have too many rules in a rule. As you can see, I have spread the length x width, material type and, if it has a chamfer, fillet or square corner over 3 rules. This also makes it easier when you are trying to trouble shoot.

So, by just changing 1 parameter we are able to change many different parameters as well. We are getting closer to our answer.

Next up: To iLogic or not to iLogic – Assembly configurations.

Kind regards,
Aldred, the Mad Hatter