Inventor 2022: New iLogic Tools

Inventor 2022 gives us some new iLogic tools to interact with the new Inventor tools.

Model States

With the release of Inventor 2022 comes the introduction of Model States.  Model States allow you to create multiple representations of a part or an assembly within a single document.  These can be used to represent:

  • Manufacturing stages
  • Simplification levels
  • Product families
  • Adjustable or flexible parts

Prior to this release we had to ensure our assembly was in a custom LoD (Level Of Detail) in order to suppress components in an assembly using iLogic.  This is no longer the case as we can suppress components inside the Master Model State.   Existing LoDs (Level Of Detail) in assemblies will be migrated to Model States inside of Inventor 2022.

There are several new iLogic snippets that allow us to interact with Model States.

Component.ActiveModelState("Part1:1")

The new ActiveModelState function in the Components (classic) category will get or set the active model state of a component in an assembly. 

Component.Replace("SubAssembly:1", "OtherAssembly.iam<Model State1>", True)

The Replace with LOD snippet has been replaced with the Replace with Model State snippet but they act the same and require the same information, just use the Model State name instead of the LoD name.  In fact, the FullFileName property in the API has been changed from FullFileName<LevelOfDetail> to FullFileName<ModelState>.

Components.AddWithModelState("a:1", "a.ipt", "Model State2")

There is a new AddWithModelState function that will allow you to add a component to the current assembly and choose which component Model State to activate.

ThisDoc.ActiveModelState

The ActiveModelState function of ThisDoc will allow you to set or get the active Model State of the active document.

While editing a model state component in-place, you cannot add or delete rules.  You can still edit or run rules.

Instance iProperties

Instance Properties are another powerful tool that was introduced in Inventor 2022.  These allow you to assign different properties to component instances.  These do not affect the component file, only the instance inside the assembly.  The Instance Properties are stored at the parent assembly level.  These can be used for things like assigning individual tags or properties to component instances.

iProperties.InstanceValue("Part1:1", "PropertyName1")

The new InstanceValue function allows you to get or set the Instance iProperty of a component.  As before, if the Instance iProperty does not exist, it will be created.

Use the InstanceExpression function to set a formula inside an iProperty.  For example:

iProperties.InstanceExpression("ModelStates:2", "PropertyName1") = "=<Vendor>"

Event Triggers

To work alongside the new Model State snippets, we now have a new Event Trigger called Model State Activated.  This works inside the document in which the event occurred.

We also now have an Event Trigger for Any User Parameter Change.  I’ve a big User Parameter fan and the lack of this Event Trigger in previous releases meant I had to do some funky workarounds.  This event is triggered when you change the value of a User Parameter (but not when adding or deleting a parameter).  As with the Model State Activated trigger, this works inside the document in which the event occurred.

Hopefully this information will help you in your Inventor 2022 automation endeavors!

About the Author

Randall Mabery

I love the technology, thoroughly enjoy helping people find solutions and believe in the software. I train individuals in the use of Autodesk design software such as Inventor and AutoCAD. The most satisfying part of my job is working on automation solutions for clients, assisting them in streamlining their design process and automating tasks.

Follow on Linkedin More Content by Randall Mabery
Previous Article
Inventor 2022 New UI Tools
Inventor 2022 New UI Tools

A new feature in Inventor 2022 that needs to be shared is the “Reset UI”.

Next Article
Troubleshooting Revit: Application Hangs or Spinning wheel
Troubleshooting Revit: Application Hangs or Spinning wheel

Autodesk Revit Issues Addin for 2020 or 2021 is installed and the user is not using BIM360 products.