Not executing rules in subassemblies ilogic

Not executing rules in subassemblies ilogic

mayla_difrancesco
Contributor Contributor
214 Views
6 Replies
Message 1 of 7

Not executing rules in subassemblies ilogic

mayla_difrancesco
Contributor
Contributor

I am writing ilogic code to manage a staircase. The staircase consists of several subassemblies, such as the "parapets".
I wrote the main rule in the "staircase" assembly, but there are other rules that are written in the subassemblies. When I execute the rule in the main assembly, the rules in the subassemblies are only executed in part. so I have to open the subassembly and re-execute it manually to get the final result.
I have also tried to call the specific rule in the rule of the main assembly with iLogicVb.RunRule("ruleName") but it does not work.
What can I do?

0 Likes
215 Views
6 Replies
Replies (6)
Message 2 of 7

ryan.rittenhouse
Advocate
Advocate

IF you need to run a rule in a subassembly, you can specify the name of the component and the rule to run like this:

 

iLogicVb.RunRule("Stringer", "Update")

 

This will run the Update rule in the Stringer subassembly

If this solved your problem, or answered your question, please click Accept Solution.
0 Likes
Message 3 of 7

mayla_difrancesco
Contributor
Contributor

I tried but it still doesn't work:


iLogicVb.RunRule("Parapetti laterali:1", "Regola parapetti laterali")


I have to manually access the "Parapetti laterali" subassembly and run it there, to get the result

0 Likes
Message 4 of 7

ryan.rittenhouse
Advocate
Advocate

Can you post an example? Without any code to look at, I'm shooting in the dark. The one thing that comes to mind since you are dealing with rules running across components is that you should make sure you are getting/setting parameters through the Parameter wrapper, and not just typing out the parameter name (blue text in the editor). If it's blue, it doesn't get updated until all the rules finish running and that can cause the behavior you are seeing.

ryanrittenhouse_0-1746621194438.png

Make sure you are use the Parameter("parameterName") method and that might solve you problem. Otherwise, post an example part and code here and I can take a look.

If this solved your problem, or answered your question, please click Accept Solution.
Message 5 of 7

WCrihfield
Mentor
Mentor

Another tip is to use the 'ThisDoc.Document' iLogic code snippet anywhere you are referring to the 'Document' that you want your iLogic rules to be working on, instead of using the 'ThisApplication.ActiveDocument' Inventor API code phrase.  The iLogic one is very useful, and works in the most appropriate way for each given circumstance, while the 'active' one will always just refer to the 'active' document.  When a rule gets ran remotely, by events, or by 'RunRule' type lines of code, then you most likely don't want the rule triggered by those events or calls to be acting on the 'active' document, but the document that triggered the event, or the document where the call for it to run originated.  The iLogic snippet catches and works properly will all those types of situations, where the 'active' one does not (usually...there are always exceptions).

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 7

mayla_difrancesco
Contributor
Contributor

I am attaching the photos:
- the photo of the assembly and the subassembly called "Parapetti laterali"
- the photo of how I called the rule in the ilogic code of the main assembly
- the photo of the subassembly where the rule I want to activate is, called "Regola parapetti laterali"

0 Likes
Message 7 of 7

CGBenner
Community Manager
Community Manager

@mayla_difrancesco @ryan.rittenhouse @WCrihfield 

Hello, did this ever get solved? 

Did you find a post helpful? Then feel free to give likes to these posts!
Did your question get successfully answered? Then just click on the 'Accept solution' button.  Thanks and Enjoy!


Chris Benner
Community Manager

0 Likes