iLogic: Avoiding Errors with LOD’s

The active Level of Detail in XYZ.iam is not a custom Level of Detail.png

If you have ever wanted to suppress a component using iLogic, you may have come up against the error message below.

The active Level of Detail in is not a custom Level of Detail

Error in rule: RuleName, in document: XYZ.iam

Component.IsActive: Cannot change the suppression state of component ABC:1.
The active Level of Detail in XYZ.iam is not a custom Level of Detail.

The reason for this, is that Inventor needs to save an assembly with known “Levels of Detail”. As an example, if you have ever manually suppressed a component, when you save the file, Inventor prompts you to name the new LOD.

@ClintBrown3D Autodesk Inventor 06

It is for the same reason, that the iLogic error occurs.

How do I fix this?

This is easily fixed, by setting our model to a custom LOD. I usually create one called “iLogic” so that I know that this is the LOD for my iLogic model. The code below will first check if a custom LOD called “iLogic” exists, if it does it sets the model to “iLogic”, and if not, it will create the custom LOD and set the model to it.

'Create and Set Custom LOD"
Dim doc As AssemblyDocument = ThisDoc.Document
Dim oLOD As LevelOfDetailRepresentation
Dim oAsmCompDef As ComponentDefinition
oAsmCompDef = doc.ComponentDefinition

Try
	oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Add("iLogic")
Catch
	oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("iLogic")
	oLOD.Activate(True)
End Try

You may want to switch back to the master LOD at some stage, so here’s the code to do just that.

'Setup for Master LOD
Dim doc As AssemblyDocument = ThisDoc.Document
Dim oLOD As LevelOfDetailRepresentation
Dim oAsmCompDef As ComponentDefinition
oAsmCompDef = doc.ComponentDefinition

'Set Master LOD
oLOD = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Master")
oLOD.Activate(True)