Running ilogic rule in Assembly from sub assembly part

Running ilogic rule in Assembly from sub assembly part

Anonymous
Not applicable
1,951 Views
4 Replies
Message 1 of 5

Running ilogic rule in Assembly from sub assembly part

Anonymous
Not applicable

I have a rule in the top assembly to update & want to run this as a final 'clean up' after various rules have run in sub assembly parts.

 

I have a rule within a part at the end of the line. I want this rule to goto the top assembly & run the 'Update' rule.

 

Could someone please provide an example of how this rule should be applied?

 

run other rule.JPG

 

 

Thanks

MES

0 Likes
Accepted solutions (1)
1,952 Views
4 Replies
Replies (4)
Message 2 of 5

MjDeck
Autodesk
Autodesk

There might be another way to do it, other than running the top-level rule from the part.
But the following should work.  It takes advantage of the fact that the top-level assembly is the ActiveDocument.

 

If (ThisApplication.ActiveDocument Is ThisDoc.Document) Then Return

Dim map As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap()
map.Add("Arg1", "Arg1Value")
auto = iLogicVb.Automation
auto.RunRuleWithArguments(ThisApplication.ActiveDocument, "ruleName", map)


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks for the reply.

I don't understand  map.Add("Arg1", "Arg1Value").

 

The top rule is called "Update" - changed  "ruleName" to Update  - resulting in:

 

If (ThisApplication.ActiveDocument Is ThisDoc.Document) Then Return  

Dim map As Inventor.NameValueMap = ThisApplication.TransientObjects.CreateNameValueMa​p() map.Add("Arg1", "Arg1Value") auto = iLogicVb.Automation auto.RunRuleWithArguments(ThisApplication.ActiveDo​cument, "Update", map)

 

& found these errors:

 

Rule Compile Errors in Update, in Hex Head Bolt.ipt

Error on Line 3 : End of statement expected.

Error on Line 4 : Name 'map' is not declared.

Error on Line 6 : Comma, ')', or a valid expression continuation expected.

 

Cheers

 

Andrew

0 Likes
Message 4 of 5

MjDeck
Autodesk
Autodesk
Accepted solution

Looks like there was a copy-and-paste problem in the post.
I attached a new version of the rule in a text file.  This one doesn't have map.Add.  It sounds like you don't need that.  map.Add allows you do send an argument (for instance a number or an option) as input to the other rule.


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 5

Anonymous
Not applicable

Thanks - this has fixed a long running issue I had having to refresh the main assembly.

MES

0 Likes