Hi @tamnn.designer . Try this code that I took here and modified a bit.
Sub Main
Dim copyFrom As AssemblyDocument = ThisDoc.Document
For Each copyTo As Document In copyFrom.AllReferencedDocuments
If copyTo.IsModifiable Then
'Copy the rules
CopyRules(copyFrom, copyTo)
'Copy the Event triggers
CopyEventsPropSet(copyFrom, copyTo)
'Save
copyTo.Save()
End If
Next
End Sub
Sub CopyRules(CopyFrom As Document, CopyTo As Document)
For Each oRule As iLogicRule In iLogicVb.Automation.Rules(CopyFrom)
Dim oCopy As iLogicRule = iLogicVb.Automation.AddRule(CopyTo, oRule.Name, "")
oCopy.Text = oRule.Text
Next
End Sub
Sub CopyEventsPropSet(CopyFrom As Document, CopyTo As Document)
Dim oPropSet As Inventor.PropertySet = CopyFrom.PropertySets("{2C540830-0723-455E-A8E2-891722EB4C3E}")
Try
CopyTo.PropertySets("{2C540830-0723-455E-A8E2-891722EB4C3E}").Delete()
Catch
End Try
Dim newPropSet As Inventor.PropertySet = CopyTo.PropertySets.Add("_iLogicEventsRules", "{2C540830-0723-455E-A8E2-891722EB4C3E}")
For Each prop As Inventor.Property In oPropSet
newPropSet.Add(prop.Value, prop.Name, prop.PropId)
Next
End Sub