Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic - Rule Driven Assembly - Update Problems

2 REPLIES 2
Reply
Message 1 of 3
andrewhaigh
1292 Views, 2 Replies

iLogic - Rule Driven Assembly - Update Problems

Hi all,

 

I've come up against a confusing wall in my rule driven assembly, hopefully someone can point out what might be the problem.

 

The setup is:

I have a rule which first gets a number of user parameters via input boxes.

 

This rule then runs a number of other rules, using:

iLogicVb.RunRule("Rule 1")
iLogicVb.RunRule("Rule 2")
iLogicVb.RunRule("Rule 3")

 Each of these rules control parameters, part/feature/constraint suppression etc. in the top level and subassemblies/parts based on the previously obtained user parameters.

 

All the rules have the 'Don't run automatically' option selected, so all should only run as intended when I manually run the first rule.

 

When I run the first rule, I enter all the parameters, and the subsequent rules run.

 

The problem is, the suppression states etc. in the subassemblies/parts do not update.

Looking at the parameters dialog box after the rules have run, all user parameters have updated with the new values.

 

If I run the first rule again the subassemblies/parts update correctly.

 

It appears that the rules that control the suppression states etc. of the subassemblies run using the initial values of the user parameters, i.e. the values as they were before the user input is obtained, rather than the new values.

 

This is confusing me, as the code is structured as follows:

user_parameter_1 = InputBox("User Parameter 1", "Input", "xx")
user_parameter_2 = InputBox("User Parameter 2", "Input", "xx")

iLogicVb.RunRule("Rule 1")
iLogicVb.RunRule("Rule 2")

Many thanks for any pointers you can offer.

 

Andy

 

- Inventor Professional 2011 64Bit SP2 -

Tags (1)
2 REPLIES 2
Message 2 of 3
andrewhaigh
in reply to: andrewhaigh

Just for information if anyone finds this while searching for a similar problem, the solution is to use the following in the main rule before the subsequent rules are called:

 

RuleParametersOutput()

As I understand it, the new parameter values need saving from iLogic back to the model (which is accomplished using the code above), from where they can be used by the subsequent rules. If you don't do this, the new parameters are not saved back to the model until the rule exits, which occurs after the subsequent rules have run.

Message 3 of 3
Carthik_Babu
in reply to: andrewhaigh

Hi,
i got this code from some link., i have not used this yet....check the same and reply
Dim map As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
map.Add("user_parameter_1", "user_parameter_1")
iLogicVb.RunRule("Rule 1", map)
Carthik Babu M.S, Asst Manager - Machine Building,
Gabriel India Ltd,Hosur, TN, INDIA
Email:carthik_ms@yahoo.co.in ,
https://grabcad.com/carthik-1/projects
"May all beings be happy" http://www.dhamma.org/

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report