iLogic - Updates

iLogic - Updates

NachoShaw
Advisor Advisor
282 Views
2 Replies
Message 1 of 3

iLogic - Updates

NachoShaw
Advisor
Advisor

Hey

 

im more of a VB.Net guy but using iLogic for some simple updates (or so i thought).

 

Base model updates parameter from 5 to 22

Assembly linked parameter shows updated value of 22

i override the BOM value from 5 to 22 using iLogic

 

iLogic persists to keep parameter value at 5. Why?

 

I have added update code before the main code

InventorVb.DocumentUpdate()
trigger = iTrigger0
RuleParametersOutput()

i have tried both the linked parameter & the base model parameter values directly.

everything updates except the iLogic collection...

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
283 Views
2 Replies
Replies (2)
Message 2 of 3

Ralf_Krieg
Advisor
Advisor

Hello

 

How do you handle the parameter in iLogic? Can you post the lines where parameter is assigned to a variable and when iLogic writes the override?


R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 3

el_jefe_de_steak
Collaborator
Collaborator

When an iLogic rule starts running, it grabs a "copy" of all parameter values and stores them in memory. If a parameter value gets changed, the change does not go into effect until after the rule is finished running. When you retrieve a parameter value with a line like "param1 = param2", it only grabs the parameter value that is stored in memory, which may be different than the actual or intended value.

 

In order to get around this, when setting and retrieving parameter values, you need to use the function Parameter("paramName"). When using this to set a parameter value, it will force the update to happen immediately. When using it to retrieve a parameter value, it will get the current value from the parent document instead of using the value stored in memory.

 

The RuleParametersOutput() statement does force an immediate update when setting parameter values, but unfortunately doesn't necessarily update the parameter values that are stored in memory.

 

Another advantage of using the Parameter("paramName") function is that you can set the expression of that parameter as well as the value:

  1. Parameter("paramName") = 1     'will set the value to 1 unit
  2. Parameter("paramName") = "1 in + d0"     'will set the expression to "1 in + d0"

 

The downsides are:

  • the rule does not run automatically when that parameter value is changed
    • this can be solved by putting a "dummy variable" at the beginning of your rule that is set to that parameter (dummyVar1 = paramName). This causes the rule to run whenever that parameter value is changed.
  • the rule does not automatically update a parameter name that is enclosed in quotation marks

 

0 Likes