iLogic rules not properly controlling suppression - 2021

iLogic rules not properly controlling suppression - 2021

llorden4
Collaborator Collaborator
867 Views
4 Replies
Message 1 of 5

iLogic rules not properly controlling suppression - 2021

llorden4
Collaborator
Collaborator

Just completing a migration from 2018 to 2021 and am facing a serious issue with iLogic rules not running properly in my assembly files with component suppression states.  I do see my commands fall under the "Classic" category so there's new commands to learn in iLogic, but it does appear the legacy commands are still supported.

 

Trigger events are not allowing the iLogic to affect change to the model with suppression (IsActive) states.

 

A manual forced run of a rule does not allow the iLogic to affect change to suppression states.

 

Opening the rule with the iLogic editor and using the Save & Close button (with not changes made) does allot the proper execution of the iLogic run and updates are properly made.

 

What can I do to allow the iLogic rules to run normally again now that I'm committed to the migration?  In deep need of a fast solution!  @johnsonshiue 

 

 

Inventor Pro 2021.0.1

Autodesk Inventor Certified Professional
0 Likes
Accepted solutions (1)
868 Views
4 Replies
Replies (4)
Message 2 of 5

llorden4
Collaborator
Collaborator

Sample file attached for review of issue; a simple assembly file that includes a form to allow the user to toggle the suppression of the part with a simple True/False toggle.

 

The trigger works only once and the only way to get it run again is to edit the rule and Save & Close, no edits required.

Autodesk Inventor Certified Professional
0 Likes
Message 3 of 5

llorden4
Collaborator
Collaborator

For my fellow drafters pretending to be programmers, I have figured out the basic concept to the new ilogic code.  It does appear to be far easier/simpler and I am able to achieve an updated iLogic code that will perform the task.  Replace the current rule contents with this...

ThisAssembly.BeginManage()
If ShowCube Then
	Components.Add("Cube:1", "Cube.ipt")
End If

It works, though I still have some things to figure out for error managing and other variable handling.

 

So while I have a grasp of what to do going forward, I still need a solution for my massive library of parts with the legacy code that are currently suffering in performance until I can get around to re-writing, well everything. 

Autodesk Inventor Certified Professional
0 Likes
Message 4 of 5

llorden4
Collaborator
Collaborator

Would like some Autodesk support/feedback on a solution here.  Working on it?  Able to duplicate?

Autodesk Inventor Certified Professional
0 Likes
Message 5 of 5

llorden4
Collaborator
Collaborator
Accepted solution

I believe I have found the root cause to this issue, it appears to me that the issue stems from how the new enhanced iLogic handles the legacy iLogic programming.  There is a specific coding sequence that cause this issue.

 

In my case, I have components in an assembly file that may be in a suppressed state.  In order for iLogic to be able to find the component occurrence, the Master LOD and view must be active so that those suppressed items become unsupressed and identifiable.  My code would typically start with...

Dim oAsmCompDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("Master").activate
oDoc.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("Master").activate

My code would then search through the component occurrences to identify each component before returning to a custom LOD. 

'Set desired Rep & LOD
Try
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Item("View1").activate 
Catch
oAsmCompDef.RepresentationsManager.DesignViewRepresentations.Add("View1")
End Try
Try
oDoc.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations("LevelofDetail1").activate
Catch
oDoc.ComponentDefinition.RepresentationsManager.LevelofDetailRepresentations.Add("LevelofDetail1")
End Try

 

The return to the Master LOD allows the iLogic rule to only run once.  You don't get an error report and everything appears normal, except that anything processed in the iLogic just doesn't run.  Forcing the rule to run does not work.  The only work around I've found is to edit the rule, and go right to the "Save & Run" option and then the rule will run immediately and then die again.

 

The final solution is to simply retire the legacy code and move on to the new managed component states supported in the enhanced iLogic.

 

So if you have libraries built on suppressed features controlled via iLogic in this manner, expect automation errors until you've completely updated your code.

Autodesk Inventor Certified Professional
0 Likes