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: 

Running ilogic rule in Assembly from sub assembly part

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
1732 Views, 4 Replies

Running ilogic rule in Assembly from sub assembly part

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

4 REPLIES 4
Message 2 of 5
MjDeck
in reply to: Anonymous

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.

Message 3 of 5
Anonymous
in reply to: MjDeck

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

Message 4 of 5
MjDeck
in reply to: Anonymous

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
in reply to: MjDeck

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

MES

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

Post to forums  

Autodesk Design & Make Report