Layne env: IyL-ketiv

by Eric Paul, February 20, 2020

How to program in Inventor iLogic – VB.NET Operators and Expressions

Back to Blog

When programming, it’s tough to get the results you want without knowing all the tools you have in your toolkit. Since Inventor iLogic is built on Microsoft’s VB.NET language, we can use their extensive documentation to get a better understanding of what’s possible and how we can achieve it.

We hosted an Autodesk Virtual Academy on iLogic and got a lot of requests for the links mentioned in the session. You can watch the original AVA below and keep reading to get access to all the topics and links from the session!

Inventor iLogic- VB.NET Operators and Expressions

We’ll break this down more, but for an overview of the possible operators and expressions in Inventor iLogic, take a look here:
Microsoft’s Visual Basic Guide

Tutorials Point VB.NET Operators

Arithmetic Operators

Microsoft’s Documentation on Arithmetic Operators 


Inventor iLogic uses the following characters to do arithmetic operations like adding, subtracting, multiplying, etc.
+ (Addition) :This operator can also be used for concatenation but is not recommended
(Subtraction and Negation)
* (Multiplication)
/ or Forward Slash (Division)
\ or Backwards Slash (Integer Division)
^ (Exponentiation)
Mod Modulo operation: the remainder after division of one number by another

Comparison Operators

Microsoft’s Documentation on Comparison Operators 

Use the following characters to perform evaluations between expressions
= (Value equality):  to test if the value of the first and second expression equal to each other
<> (Value inequality): to test if the value of the first and second expression unequal to each other.
< (Less than): to test if the first value less than the second.
> (Greater than): to test if the first value greater than the second.
<= (Less than or equal to): to test if the value of the first less than or equal to the second one.
>= (Greater than or equal to) : to test if the value of the first greater than or equal to the second one.
(Is Object) reference equality
(IsNot Object) reference Inequality

Concatenation Operators

Microsoft’s Documentation on Concatenation Operators 

Two symbols can perform concatenation operations, “&” and
“+”. However, using the “+” symbol in Inventor iLogic is not recommended as it also can perform addition operations which can lead to some unexpected results.

For example, if you wanted your file name to include the height and width of your part and you used “+” to concatenate:
PartName = “MyPart”
Height = 24
Width = 13
FileName = PartName + Height + Width + “.ipt”
FileName would come out to “MyPart37.ipt” instead of the expected “MyPart2413.ipt”

Logical Operators

Microsoft’s Documentation on Assignment Operators 

Logical operators compare expressions and return a Boolean result, that is True or False.
(And): Returns True if all compared expressions evaluate to True. Will always evaluate all expressions
(Or): Returns True if at least one compared expression evaluates to True. Will always evaluate all expressions
(Xor): Returns True if exactly one compared expression evaluates to True
(AndAlso): Similar to And, will compare expressions in order and will return False immediately if an expression returns False
(OrElse): Similar to Or, will compare expressions in order and will return True as soon as one expression evaluates to True
In most scenarios, using AndAlso or OrElse is the most useful version.

In general, this article shows you all the basic Inventor iLogic – VB.NET operators and expressions to help you exceed in programming.

If you want to read more Inventor iLogic articles, click here.

Back to Blog

Leave a Reply

Your email address will not be published. Required fields are marked *

More stories from KETIV


4 Key Reasons to Use 3D CAD Software

If you are considering using 3-dimension (3D) CAD software on your next design, you have come to the right place! There are several reasons to consider using a 3D CAD program such as Autodesk Inventor or Fusion 360 to develop your next…

Read post

What are Part Numbers and Stock Numbers in BOM?

This is the second part in the “Level 2” BOM Series. These blogs will be focused on Bill of Materials (BOM) management. The Level 200 topics include: 201 – Equivalent Components 202 – Part Numbers and Stock Numbers- This Post! 203 – BOM…

Read post