External rule not running in occurrences

External rule not running in occurrences

donaldleigh
Advocate Advocate
528 Views
5 Replies
Message 1 of 6

External rule not running in occurrences

donaldleigh
Advocate
Advocate

Morning all

 

I would like to be able to run an external rule I have created that is attached called "Generator" from another rule called "Run Generator on all". The "Run Generator on all" will be run on the top level assembly and will cycle through all my assemblies and parts and run the "Generator" rule on each Assembly and Part. 

 

Problem I have is that when each Assembly and Part is opened via the "Run Generator on all" rule the "Generator" rule is not running on the parts or assemblies. I'm sure its do do with the 1st few lines of the "Generator" rule but I cant work out how to change this. The "Generator" rule will also need to work when run directly from any Assembly or Part.

 

I know the "Generator" rule is not the cleanest but it works for me.

 

Thanks everyone

Running Inventor 2022

Donald

 

0 Likes
Accepted solutions (1)
529 Views
5 Replies
Replies (5)
Message 2 of 6

A.Acheson
Mentor
Mentor

Can you indicate what errors your getting? Is the external rule being started and can you get the correct document that you want to make changes in? Use  a message box to determine if you activated the right document. 

Messagebox.Show(oDoc.DisplayName)

 The iproperty snippets can be an issue when ran indirectly through rules. Are these the parts that are failing? If so you may need to change to API Property sets.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 6

donaldleigh
Advocate
Advocate

hi @A.Acheson .

I'm not getting any errors. Its not running the "Generator" rule on the parts and assemblies when opened via the "Run Generator on all" rule. 

 

I put the message box you posted in the  "Run Generator on all" rule before the iLogicVb.RunExternalRule("Generator") line and it returns the file name of the top level assembly when each part and assembly is open.

 

I then put that same message box in the "Generator" rule (Removed it from "Run Generator on all" rule) and again it returns the file name of the top level assembly when each part and assembly is open.

 

Cheers

Donald

0 Likes
Message 4 of 6

donaldleigh
Advocate
Advocate
Accepted solution

I have worked it out. It was in the "Run Generator on all" rule and not the "Generator" rule.

 

I have attached the updated "Run Generator on all" rule

 

Cheers

Donald

0 Likes
Message 5 of 6

A.Acheson
Mentor
Mentor

Does the rest of the rule function correctly when you assign a document to the external run? If it does I've learned something new today as well. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 6 of 6

donaldleigh
Advocate
Advocate

When I changed in the "Run Generator on all" rule the "Generator" rule seems to run as it should.

 

Will still need to test it more but I think it all works perfect. Thanks for your help @A.Acheson because you made me realise that it was the "Run Generator on all" rule that as incorrect.

 

Donald

0 Likes