- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oFolderPath = ThisDoc.Path
Dim AssyName As String = "1001-"
Dim ShopField As String = "SB"
Dim oFSO As Object = CreateObject("Scripting.FileSystemObject")
Dim oFolder As Object = oFSO.GetFolder(oFolderPath)
Dim oFiles As Object = oFolder.Files
Dim BuyBiggest As Integer = 1
Dim AssetLib As AssetLibrary
Try
AssetLib = ThisApplication.AssetLibraries.Item("MyCustom Material Library")
Catch
MessageBox.Show("The MyCustom Material Library is not installed. Please install before continuing.", "Missing Material Library")
Return
End Try
For Each oRefDoc As Document In oAsm.AllReferencedDocuments
Dim oRefDocs = oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc)
Dim NeedZero As String = ""
If oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject
Dim oRefDocPath As String = oRefDoc.FullFileName
If oRefDoc.ComponentDefinition.IsContentMember() = True Then
If BuyBiggest < 10 Then NeedZero = "0"
Dim SavePartName As String = AssyName & ShopField & NeedZero & CStr(BuyBiggest)
oRefDoc.SaveAs(oFolderPath & "\" & SavePartName & ".ipt", 0)
Dim oRefDocMat As Asset = Nothing
oRefDocMat = AssetLib.MaterialAssets.Item("STEEL")
oRefDocMat.CopyTo(oRefDoc)
oRefDoc.ActiveMaterial = oRefDoc.MaterialAssets.Item(oRefDocMat.DisplayName)
BuyBiggest = BuyBiggest + 1
End If
End If
Next
Not entirely sure what I'm doing wrong here. Line 36 is the "Member Not Found" error.
This is a simplified version of my full iLogic rule. My code saves the standard content center files into a read/writable folder and edits the iProperties of the parts. All of the properties edit just fine with my iLogic, except the Material.
Solved! Go to Solution.
Link copied