Hi @J.VandeMerckt. Luckily that is a relatively easy task to automate...now. Deleting the forms was only discovered fairly recently though. Below is something you can try. However, this will also delete the local Event Triggers settings in each document. If you do not want to delete the local (in 'This Document' tab) Event Triggers settings in each document (which may also run external rules on events), then just delete or comment out those lines of code, as needed.
Sub Main
Dim oDoc As Inventor.Document = ThisDoc.Document
DeleteEventTriggersPropSet(oDoc)
iLogicVb.Automation.DeleteAllRules(oDoc) 'deletes all rules in this and all referenced documents
DeleteInternalForms(oDoc) 'run the custom Sub routine on the active document if needed
Dim oAllRefDocs As DocumentsEnumerator = oDoc.AllReferencedDocuments 'all levels
If oAllRefDocs.Count > 0 Then
For Each oRefDoc As Document In oAllRefDocs
DeleteEventTriggersPropSet(oRefDoc)
'iLogicVb.Automation.DeleteAllRulesInDocument(oDoc) 'only that document
DeleteInternalForms(oRefDoc) 'run the custom Sub routine on this referenced document
Next
End If
BlinkiLogicWindow 'runs custom Sub routine below
If oDoc.RequiresUpdate Then oDoc.Update2(True)
If oDoc.Dirty Then oDoc.Save2(True)
End Sub
Sub DeleteInternalForms(oDoc As Document)
If oDoc Is Nothing OrElse oDoc.IsModifiable = False Then Return
Dim oDocAttSets As AttributeSets = oDoc.AttributeSets
If oDocAttSets.Count = 0 Then Return
For Each oSet As AttributeSet In oDocAttSets
If oSet.Name.StartsWith("iLogicInternalUi") Then
Try : oSet.Delete : Catch : End Try
End If
Next 'oSet
End Sub
Sub DeleteEventTriggersPropSet(oDoc As Inventor.Document)
Dim oSet As Inventor.PropertySet = Nothing
If oDoc.PropertySets.PropertySetExists("{2C540830-0723-455E-A8E2-891722EB4C3E}", oSet) Then
Try : oSet.Delete : Catch : End Try
End If
End Sub
Sub BlinkiLogicWindow()
Dim iLogicWindow As DockableWindow = ThisApplication.UserInterfaceManager.DockableWindows.Item("ilogic.treeeditor")
iLogicWindow.Visible = False
iLogicWindow.Visible = True
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)