Hi @Sketchart_Cad1. Since there has not been any response to anything I posted in Message 5 earlier, and you seem to have accepted yet another solution which still contains that odd block of code in it that I mentioned did not appear to be valid, I feel like I may need to post additional information here to reinforce some of what I said earlier, and show the 'proper' way to do what you seem to be wanting to do there.
Unless you are using Inventor 2025, which I do not have yet, and unless they have just added that DrawingDocument.iLogic.Rules property to the DrawingDocument object in the 2025 version, then that line of code is meaningless and does not work at all. For many, many years now, if you want to be able to iterate through all of the internal iLogic rules within an Inventor document, you had to do so very similar to the following way:
Dim oDoc As Inventor.Document = ThisDoc.Document
Dim iLogicAuto As IiLogicAutomation = iLogicVb.Automation
Dim oRules As IEnumerable = iLogicAuto.Rules(oDoc)
If oRules IsNot Nothing Then
For Each oRule As iLogicRule In oRules
If oRule.IsActive Then
iLogicAuto.RunRuleDirect(oRule)
End If
Next oRule
End If
In this example above, we always have to use the 'iLogicVb.Automation.Rules() property to get an IEnumerable type collection containing the iLogicRule objects. Then, we had to check if that oRules variable (representing the IEnumerable) 'Is Nothing', because if no rule were found, it would be Nothing, instead of just having a count of zero. Then, we could read/edit the primary settings of each rule &/or or read/edit the text of the rule &/or or run the rule.
And if we just want one specific iLogic rule from within an Inventor document, we would have to do it this way:
Dim oDoc As Inventor.Document = ThisDoc.Document
Dim iLogicAuto As IiLogicAutomation = iLogicVb.Automation
Dim oRule As iLogicRule = iLogicAuto.GetRule(oDoc, "The Rule's Name Here")
If oRule IsNot Nothing Then
iLogicAuto.RunRuleDirect(oRule)
End If
In this example above, we are using the iLogicVb.Automation.GetRule() method. That method asks us to specify which Document object to attempt to retrieve the iLogic rule from, and to specify the name of the iLogic rule for it to find. If it does not find an internal iLogic rule with the specified name, within the specified document, it will not throw an error, but instead will return 'Nothing'. Because of this, we always need to check of oRule 'Is Nothing', before trying to do something with that variable that may (or may not) represent an iLogic rule object.
Now, with the two primary ways of accessing internal iLogic rule objects within documents out of the way, next I must point out the proper way to 'regenerate all rules' in a document. This is because of the comment in your code just before that block of code states that this is what you intended to happen with the following block of code. As mentioned in Message 5, the command (ControlDefinition) named "ilogic.runrule" does not exist on my computer, so I suspect that line of code is either simply not doing anything, or is just not doing the right thing. And if so, I am surprised that it is not throwing an error every time it is encountered (if that line of code even gets encountered at all). When I try to run this line of code:
ThisApplication.CommandManager.ControlDefinitions("ilogic.runrule").Execute()
...I get the following error message, which essentially means that it can not find any ControlDefinition with that name among all available ControlDefinitions.

And just as added information, below is a list of all similar iLogic related commands (ControlDefinitions), which you will notice does not contain that command.
iLogic.About
iLogic.AddForm
iLogic.AddRule
iLogic.AssignName
iLogic.ClearCodeClipboard
iLogic.Configuration
iLogic.DeleteAllRules
iLogic.DeleteName
iLogic.DrawingGenerateCode
iLogic.EditName
iLogic.EditRule
iLogic.EventTriggers
iLogic.FreeILogicMemory
iLogic.HideLabel
iLogic.HideLabels
iLogic.iCopy
ilogic.logwindow
iLogic.PlaceComponent
iLogic.RegenAllRules
iLogic.RuleBrowser
iLogic.ShowLabel
iLogic.ShowLabels
ilogic.treeeditor
iLogic.Trigger
iLogic.XmlExport
iLogic.XmlImport
Also, as you can see in this list, if you were truly attempting to 'regenerate all rules', then the proper command name that should be used is "iLogic.RegenAllRules", not "ilogic.runrule". So, that one line of code could be changes like this:
ThisApplication.CommandManager.ControlDefinitions("iLogic.RegenAllRules").Execute()
This command would only need to be used once per document, not once for each iLogic rule that exists within a document. So, it should not be used within a loop of each iLogic rule in a document, because that loop of rules would no longer be needed. This code will not only run every rule in the document, in the order they appear in the document, but will also fix any 'broken' parameter links, if any are currently broken.
The only thing that comes to mind about how the previous two code examples that were accepted as solutions could have possibly worked, is maybe if the rules that needed to run in the drawings were set-up to run automatically by the Event Triggers settings, under the 'After Open Document' event. And if that was the case, then that whole block of code which seems like it is trying to run or regenerate rules, could simply be deleted (since it isn't doing anything anyways). But if something was potentially 'broken' in those rules, then you could replace that block of code with that one command I mentioned above, to actually regenerate them.
Wesley Crihfield

(Not an Autodesk Employee)