iLogic - Updating when running code

iLogic - Updating when running code

NachoShaw
Advisor Advisor
258 Views
1 Reply
Message 1 of 2

iLogic - Updating when running code

NachoShaw
Advisor
Advisor

Hey

 

What is the magic solution to getting iLogic to actually update when a rule is run because its not working for me.... I have a sketch that, depending on the height, changed a depth from 3in to 4.5in if the height exceeds a threshold. I have added 

 

iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate()

 

both before and after the code but nothing gives. Once the rule has completed, if i run it again with no parameter changes it will update correctly but during the run when the height parameter is changed, it doesnt update.

 

Why would this occur and how can i get it to update when the parameter is changed and not after on a re-run?

 

Thanks

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Accepted solutions (1)
259 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor
Accepted solution

Assuming this is a local rule. This happens due to a local parameter being (static) within the rule. It isn't controlled by the parameter function. e.g a parameter called "Length" when changed will automatically run the rule but can't update to be used elsewhere in the same rule. Which is why the rule needs to be run twice. Once to change the value, the second to update the value. 

 

But if you use the parameter function like Parameter("Length") you can use the update methods and control the updates as necessary during the rule.

 

To trigger set up the events to change on parameter change or even use the local parameter changing at the top of the rule to trigger the rule to run and later use the parameter function. 

 

 

Parameter.UpdateAfterChange = True
Parameter("d0") = 2.5
'This will update the model.

 

 

Sourced from this following article here

 

Parameter.UpdateAfterChange = True

True will cause the model (document) to Update after a parameter value is changed by the Parameter function. This only takes effect when you change parameters using the Parameter function. For example:

 

Parameter.UpdateAfterChange = True

Parameter("d0") = 2.5

This will update the model.

 

Note: ("d0") = 2.5 will NOT update the model

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes