Hi @steven.coxVCM6J ,
Yep, it'll work with 2022 and beyond, I just saved it as a 2022 file because that's oldest version I have loaded at the moment.
I just updated the batch file to include the code below, that is a rule to delete a rule of a certain name, as well. In case you decide that deleting the internal rules and using a single external rule is the better option.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
'name of rule to delete
sRuleName = "Test Rule"
Dim oDoc As Document
oDoc = ThisApplication.ActiveEditDocument '<- important that this is activeEditDoc for the batch tool
' Define the iLogic addin
Dim iLogicAddIn As ApplicationAddIn = _
ThisApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
' Get the iLogic automation object
Dim iLogic As Object = iLogicAddIn.Automation
'get collection of rules
Dim ruleName As String
Dim rules As Object
rules = iLogicVb.Automation.Rules(oDoc)
'make sure there are rules in the file
If rules Is Nothing Then
Return 'exit rule
End If
'delete rule
For Each iRule As iLogicRule In rules
If iRule.Name = sRuleName
iLogicAddIn.Automation.DeleteRule(oDoc, iRule.Name)
End If
Next