No, You Can't Do That: Enforcing Standards with iLogic

IMAGINiT Tricks Tutorial: Use this Autodesk Inventor functionality to ensure that all your designs are compliant.

Editor's note: This tutorial courtesy of IMAGINiT Technologies.

Are you having a hard time enforcing your design group's modeling standards? In this tutorial, I'll show you how to use Inventor's iLogic functionality to make sure your designs are compliant — every time.

Why Templates?

If your design group is creating parts that are similar to one another, you can save a great deal of time by creating a "head-start" template. If every part you make starts with a rectangular extrusion, why not create a template containing the extrusion and save yourself a few minutes every day? It's easy to do this in Inventor — just model up the template you'd like to work with and navigate to Inventor's Save As menu. There, you'll find the Save Copy As Template command. This will allow you to save off your template in the appropriate location.

The Save Copy As Template command.

Building Smart Templates

Now that you've cut down on some repetitive modeling, let's take things to the next level: standards compliance. Since we're working with a common template, it's easy to embed rules in our parts that enforce our design group's standards. With a few simple clicks, we can use Inventor's iLogic technology to build "smart" templates that will alert the user to any non-compliant geometry.

Preparing the part. The first thing we'll need to do is add parameters to our parts in an intelligent way. We'll be writing rules to monitor these parameters; for instance, if a part always needs to be less than five inches in length, we'll create a rule that keeps an eye on our Length parameter. Sometimes we'll need to monitor dimensions that aren't necessarily model parameters. In this case, we'll need to create driven dimensions and monitor the associated reference parameters.

Let's take a look at an example. I'd like to create a template for the adapter fitting seen here, which changes dimensions based on the fitting and plate sizes.

Adapter assembly.

It's important that the fitting and adaptor do not interfere; as a result, we need to maintain 1" of clearance around the fitting. In order to monitor this distance, I need to create a driven dimension.

Here, you can see the reference parameter that I've created using the Driven Dimension tool. Note that I renamed this dimension using the Parameters dialog box.

The driven dimension that we'll be monitoring.

Embedding rules. Now that we've got our parameter all set, it's time to embed an iLogic rule into our template. Click Add Rule on the Manage tab to open up the iLogic Rule Editor. You'll need to give your rule a name — remember to be descriptive!

In most rules, the first thing we'll be doing is creating a logical statement. In a nutshell, we're just translating the logic you would use while making design decisions into a format that Inventor can understand. In our adaptor example, the real-world logic that I'd like to translate goes like this:If the distance between the fitting and the part's edge is less than 1", we can't make the part.

Since the distance between the fitting and the part's edge is described by the reference parameter we created above, it's easy to see how we can put this statement in Inventor's language. In order to do this, press the If…Then…End If button on the rule editor's toolbar. This will provide a template for our logical statement.

From here, it's just a matter of filling in the blanks:

If Clearance < 1 Then'We can't make the partEnd If

The last thing we need to do is tell Inventor what to do if we can't make the part. Since we are enforcing standards, let's have Inventor display an error message if the clearance distance is less than 1". First, position your cursor on the second line of your rule. Then, expand the MessageBox section of the Snippets panel and double-click on the Show snippet. This snippet will tell Inventor to display a message box if the above condition is satisfied. You'll need to replace the Title and Message fields with your own text:

If Clearance < 1 ThenMessageBox.Show("There is not enough clearance.", "Error!")End If

That's it! The iLogic rule is finished. Press OK at the bottom-right of the screen and give your rule a try. We can see the dialog box that our iLogic rule has generated.

From here, it's just a matter of saving the file as a template. With just a few lines of code, we've created a smart template that will actively enforce our design group's standards. This tutorial is only the tip of the iceberg — using iLogic, we can monitor and enforce things like part color, weight, and more.

About the Author: Paul Harrison

Note: Comments are moderated and will appear live after approval by the site moderator.

AutoCAD Tips!

Autodesk Technical Evangelist Lynn Allen guides you through a different AutoCAD feature in every edition of her popular "Circles and Lines" tutorial series. For even more AutoCAD how-to, check out Lynn's quick tips in the Cadalyst Video Gallery. Subscribe to Cadalyst's free Tips & Tools Weekly e-newsletter and we'll notify you every time a new video tip is published. All exclusively from Cadalyst!Follow Lynn on Twitter