iLogic Boolean Parameter Not Updating Across Rules in Autodesk Inventor

iLogic Boolean Parameter Not Updating Across Rules in Autodesk Inventor

muddassir01
Participant Participant
149 Views
1 Reply
Message 1 of 2

iLogic Boolean Parameter Not Updating Across Rules in Autodesk Inventor

muddassir01
Participant
Participant

I have an assembly file with a Boolean parameter that should toggle between True and False based on conditions set in the "Update_Param" rule. This rule is executed by another rule called "FIRE_ALL_RULES".

The issue is that when "Update_Param" updates the Boolean parameter, the change appears to be applied. However, when I access the same parameter in "FIRE_ALL_RULES" after running "Update_Param", the updated value is not reflected.

To replicate this, I created a dummy file with two rules, but I’m facing the same issue.

Below is my code snippet for reference.

 

FIRE_ALL_RULES

MessageBox.Show("ABC BEFORE: " & ABC)
iLogicVb.RunRule("RULE_RUNNER")
RuleParametersOutput()
iLogicVb.DocumentUpdate()
MessageBox.Show("ABC AFTER: " & ABC

 RULE_RUNNER

Dim a As Integer = 1
oDoc = ThisDoc.Document
MessageBox.Show("INSDIE: " & iLogicVb.RuleName)
ABC = False
MessageBox.Show("ABC IS: " & ABC)
If a <> 0
	ABC = True
	RuleParametersOutput()
	iLogicVb.UpdateWhenDone = True
End If
MessageBox.Show("ABC IS: " & ABC)

 

I just run "FIRE_ALL_RULES", and it gives me this output in the same order (Parameter ABC is initially set to "FALSE");

muddassir01_0-1741338324546.png

muddassir01_1-1741338335572.png

 

muddassir01_2-1741338347249.png

muddassir01_3-1741338357998.png

muddassir01_4-1741338365254.png

 

Now, ABC_AFTER Should give a "True" value instead of "False".

 

Any insights or suggestions to resolve this issue would be highly appreciated. Thank you in advance for your help! 🙌

Best Regards,

Muddassir

 

 

0 Likes
150 Views
1 Reply
Reply (1)
Message 2 of 2

ryan.rittenhouse
Advocate
Advocate

What you are running into is a quirk of how you are accessing the Parameters in your document. If you access them by just using the name and getting the blue text (top line in the picture below), Inventor will generally only apply those changes when all the iLogic rules have finished running, which can lead to the behavior your are seeing. If you access it with the Parameter wrapper (bottom line below), it will update immediately, no matter where it is being called from. Switch the places you are using 'ABC' to 'Parameter("ABC")' and that should fix it.

 

ryanrittenhouse_0-1741351003114.png

 

If this solved your problem, or answered your question, please click Accept Solution.
0 Likes