Inventor 2022: New iLogic Tools

April 13, 2021 Randall Mabery

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 Properties

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.

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

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

The Instance Property type is dependent upon the argument passed to it, similar to using the iProperties.Value snippet.

iProperties.InstanceValue("Part1:1", "Will_Be_A_Number") = 5

iProperties.InstanceValue("Part1:1", "Will_Be_Text") = "5"

iProperties.InstanceValue("Part1:1", "Will_Be_A_Date") = CDate("04/18/2000")

iProperties.InstanceValue("Part1:1", "Will_Be_A_Boolean") = True

Use the InstanceExpression function to set a formula inside an Instance Property.  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
Fusion 360 Arranged Nesting
Fusion 360 Arranged Nesting

Fusion 360 to the rescue. The Manufacturing model has an “Arrange” command that will lay the pieces out for...