Banner_2.png
[   RESOURCES   ]
VinzeroLogo_reverse.png

iLogic - Tips & Tricks

February 01, 2022 By Chris Smith


iLogic in Inventor is a powerful tool that helps designers improve their time to market, ensure standard compliance, create watermarked pdfs and many other tasks by automating them through simple coding.


In this blog I am going to share a few of my most important tips when it comes to using iLogic in your CAD files.


1. Comments, comments, comments.

I cannot stress the importance of comments within your code. While working on our code we can overlook adding comments as we know what we are expecting of the code at that time. The issue arises when you need to modify said code in the future, after weeks, months or even years.


You may want to:

  1. Copy the body of the code and change it to suit another product.

  2. The product may change over time making the old code obsolete and in need of updating.

  3. There are many reasons we may need to edit our code, or even a colleague’s code.

Without adding comments to a key area of your code to let the next operator know what each section is doing, you would instead have to read though and parse the code before making changes. It can be frustrating trying to understand what your intentions were in the past. Even more so when it isn’t your code.


If I could emphasise one tip, it would be the importance of comments.

2. Housekeeping is key to good code.

Tidy code is happy code, or to be more precise, clean code is a better functioning code. Do not try to over complicate code unnecessarily and try to enter your code in logical steps and use the comment block feature ( ’[ code body ]’ ) to arrange your code.

3. IF or Select?

The basics we learn in iLogic are generally if X happens, do Y. This is probably the most commonly used function in iLogic. This can however leave us blinkered to the other functions in iLogic that have similar outputs. The Select Case command allows users to complete the same IF conditions but in a cleaner format. A Case is basically an IF/Then function with less typing. A Select Case function rolls up the IF condition Then into a single word… Case. The parameter is then identified and the “case” for that input is entered.


Below shows each way of writing code to get the same results. It’s basic but clearly shows the two ways. Although replacing a single IF/Then statement with a Select Case statement isn’t going to revolutionise your coding, doing this in large rules will save time and help the code be a bit more easily read.


The example below is a simple search for a save as command.

4. Know the API’s

Another simple tool that users tend to overlook is the Help file for iLogic API’s. This help file contains all the usable APIs for iLogic as well as some examples of how they can be used. The image below shows where to access the help file.

For some users it can be daunting trying to understand coding that isn’t a standard snippet, or that is a little more advanced. Getting familiar with the API help file will get a beginner creating professional code in no time.

So, there are a few of my simple tips to get any iLogic user creating quality iLogic rules with good working practices. I hope you found this helpful and thank you for taking the time to read my article today.

homepage_bg.jpg
[   VINZERO. RETHINK & LEVERAGE   ]

Explore our Think Community.

VinZero's Think Future Podcast

Coming Soon!

See how other companies are working towards net zero

Case studies and blogs featuring VinZero in Action around the globe

Live webinars that allow you to learn at a time that suits you

Create your own Think Folder of favourite resources