Sub Main() oADOC = ThisDoc.ModelDocument If oADOC.DocumentType <> kAssemblyDocumentObject Then MessageBox.Show("This rule cannot be executed in this file type.", "iLogic") Exit Sub End If Dim oAsm As AssemblyDocument = ThisDoc.Document Dim oTransaction As Transaction = ThisApplication.TransactionManager.StartTransaction(oAsm, "FG Member Material Changer") 'Make this a single transaction Dim oAL_List As New ArrayList Dim lib_List As New ArrayList For Each oAL As AssetLibrary In ThisApplication.AssetLibraries If InStr(oAL.DisplayName , "Material") <> 0 Then oAL_List.Add(oAL.DisplayName) End If Next Dim oALSelect As String = InputListBox("Select Asset Library", oAL_List, oAL_List(0), "Change Part Material", "Available Selections") If oALSelect Is Nothing Then Exit Sub Dim oLib As AssetLibrary =ThisApplication.AssetLibraries(oALSelect) For Each libAsset In oLib.MaterialAssets lib_List.Add(libAsset.DisplayName) Next lib_List.Sort Dim oLibAssetSel As String = InputListBox("Select Material", lib_List, lib_List(0), "Change Part Material", "Available Selections") If oLibAssetSel Is Nothing Then Exit Sub iProperties.Value("Custom", "Frame_Material") = oLibAssetSel For Each oDoc As Document In oAsm.AllReferencedDocuments 'Traverse all referenced documents If oDoc.DocumentInterests.HasInterest("{AC211AE0-A7A5-4589-916D-81C529DA6D17}") _ 'Frame generator component AndAlso oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject _'Part AndAlso oDoc.IsModifiable _ 'Modifiable (not reference skeleton) AndAlso oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc).Count > 0 'Exists in assembly (not derived base component) Try iProperties.Value(oDoc, "Physical", "Material") = iProperties.Value("Custom", "Frame_Material") Catch MessageBox.Show("Failed", "iLogic") Exit Sub End Try iLogicVb.UpdateWhenDone = True End If Next oTransaction.End End Sub