Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am tryin to write some iLogic code to check if particular materials (plural) exists in de local document and if not copy the materials to the document. I found this in the help. The materials to check on I placed in an array. A for each should then go through this array and check if the material exists and if not copy it to the document. Unfortunately it does not work like this. When I change the 'i' in the for each to for example "Yellow Paint" it works.
What am I doing wrong?
Dim oDoc As PartDocument = ThisDoc.Document Dim oCompDef As ComponentDefinition = oDoc.ComponentDefinition Dim oBody As SurfaceBody Dim assetLib As AssetLibrary Dim localAsset As Asset Dim libAsset As Asset Dim Material As Object Dim i As Integer materialArray = New String() { MainColour & "Paint", "Belt", "Black Paint", "Roller", "Steel" } i = 1 For Each Material In materialArray On Error Resume Next localAsset = oDoc.Assets.Item(i) If Err.Number <> 0 Then On Error GoTo 0 assetLib = ThisApplication.AssetLibraries.Item("MHSEMaterialLibrary") libAsset = assetLib.AppearanceAssets.Item(i) localAsset = libAsset.CopyTo(oDoc) End If i = i + 1 Next
Solved! Go to Solution.