Hi @Tigerpirro.
Try changing this line:
iLogicVb.RunExternalRule("Test.txt")
to this:
iLogicVb.Automation.RunExternalRule(oRefDoc, "Test.txt")
This other method tells the external rule which document to use as the context of the rule that it is going to run. However, in most cases the rule that it is going to run would also need to be prepared correctly to use that document, but I think it should work OK in your case here.
That iProperties line:
iProperties.Value("Custom", "Test") = "test"
does not specify which document it is supposed to be targeting, as it currently is, so it would normally default to targeting the 'local' document (the document the rule is saved within), if the rule was saved within a document, but when used in an external rule, that designation gets blurred a bit. The next document it would normally target is the 'active' document, which in your case is still the main assembly, not any of the referenced documents you are looping through. This scenario should help fix this confusing issue of what document that iLogic snippet is targeting for you...I hope. 😉
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)