Hey
I found with iLogic that parameters dont always update when a rule runs and sometimes a rule needed to be run twice. This was pointed out to me last week that a blue Parameter may not update so instead, use it like this-
Dim oParams As UserParameters = oDef.parameters.UserParameters
oParams("ParameterName").Value = 100 in
This updates the parameters as they are changed but in doing so raises another issue; Lag. I am updating 150 Parameters from vb.net and using iLogic to make local calculations but now im using this different parameter method, the rule runs on EVERY parameter change and each change takes about 5 seconds to update the base model even if geometry is not changing. My base model has from a 7 second update to 12.5 minute update......
So my question is:
How can i stop iLogic running until all of the parameters have been updated? I have put a condition in place with a parameter called RunTheRule = 0 and from VB.Net, change this one last to a value of 1 and the rule is conditionally running on RunTheRule = 1 but i was hoping there was a more elegant built in method (even though i know iLogic is far from elegant..)
Thanks
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
These would be my first suggestions:
SampleIntendedValue = 15
iLogicVb.Automation.EnterDelayedRuleRunningMode
Parameter.UpdateAfterChange = False
'set your parameters with "correctness" validation
If Parameter("test") <> SampleIntendedValue Then Parameter("test") = SampleIntendedValue
iLogicVb.Automation.ExitDelayedRuleRunningMode
iLogicVb.UpdateWhenDone = True
Is it triggering rules to run or updating parameter expressions referencing the changed parameters that is giving you issues?
@J-Camper wrote:Is it triggering rules to run or updating parameter expressions referencing the changed parameters that is giving you issues?
The issue im getting is that i think the rule is updating every time a parameter value is updated from my VB.Net process. What i would like to happen is
What i feel i have is
Thanks
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
If it is rules triggering, then I think "DelayedRuleRunningMode" is what you want to use. simple test:
Rule 1:
iLogicVb.Automation.EnterDelayedRuleRunningMode
MessageBox.Show(Parameter("triggeringParam"), "Starting Value")
Parameter("settingParam") = InputBox("Provide new number", "Test", 5)
MessageBox.Show(Parameter("triggeringParam"), "Intermediate Value")
iLogicVb.Automation.ExitDelayedRuleRunningMode
MessageBox.Show(Parameter("triggeringParam"), "End Value")
Rule 2:
Trigger = settingParam
Parameter("triggeringParam") = Parameter("settingParam")+18
Prerequisites:
Parameters named: ("settingParam", "triggeringParam")
Let me know if that doesn't help your issue
Hi @NachitoMax. I know you said you changed from using 'blue' parameters in your iLogic rule, to using API, for working with parameters, but if you do not want the iLogic rule to be triggered to run by parameter changes, you could simply check the checkbox option within the iLogic Rule Editor for that rule named "Don't Run Automatically". The blue parameters, and the Parameter("ParamName") iLogic snippet are both handy, because they allow you to work in document units directly, while the API route forces you to work with database units, but sometimes they are not ideal for the situation, and the automation the blue parameters cause is not always wanted. This is just one way to disable that specific type of automation for that one rule. Then, that rule will only run when it is called to run. But if you have this rule listed within your Event Triggers dialog, under parameter change events, there is another way to handle this...similar to the above suggestion. You could actually just suppress the iLogic rule, then make your changes to parameters, then un-suppress the rule, then run it. I have done that process in several scenarios.
Wesley Crihfield
(Not an Autodesk Employee)
Hi
Thanks for the replies so far. iLogic isnt that logical is the sense im getting. Using the rules vs api-
This-
my_param = 20 in
doesnt always update, especially if there are other parameters requiring a change down stream. I have found that the rule needs to be run twice in order to get the values updated. First run to update the params being updated, the second rum to update any referenced params reliant on the first param getting updated.
This-
oParam("my_param").Value = 20 in
will force the parameter to be updated every time but the rule is running on every parameter change.
Both methods have limitations that i feel need more resolution in iLogic
There is no manual intervention, my model is opened via VB.Net, parameters updated and then closed without saving. For now im going to try a flag parameter that i change at the very and conditionally run the rule on a True value. I can't see how to implement the 'iLogicVb.Automation.EnterDelayedRuleRunningMode without my rule as i would need some sort of flag to say the parameter updating process has finished..
Thanks
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.
How about this combination. Sourced from this following article here
“
To update the model in the middle of the rule (after changing some parameters) use these two statements together:
If you do not need to update the model in the middle of the rule, you can tell the system to update when it has finished running the rule. Use this statement: iLogicVb.UpdateWhenDone= True.”
—-——————————————————————
In addition I am not sure I saw the third parameter reference here via the parameter function. It will have a different interaction than the api equivalent I think?
Parameter("my_param") = 12 in
Can't find what you're looking for? Ask the community or share your knowledge.