Material Updating Incorrectly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
j = List.Count 'j = 18 For i = 2 To j+1 sNewName = GoExcel.CellValue("B" & i) doc.SaveAs(oooFolder & GoExcel.CellValue("A" & i) & " " & sNewName & ".ipt", True) xDoc = ThisApplication.Documents.Open(oooFolder & GoExcel.CellValue("A" & i) & " " & sNewName & ".ipt") If GoExcel.CellValue("C" & i) = "ABS" Then iProperties.Material = "ABS Plastic" Else If GoExcel.CellValue("C" & i) = "Acrylic" Then iProperties.Material = "Polycarbonate, Clear" End If InventorVb.DocumentUpdate(True) Dim oPars As UserParameters = xDoc.ComponentDefinition.Parameters.UserParameters oPars.Item("width").Expression = "isolate(" & GoExcel.CellValue("G" & i) & ";in;in)" oPars.Item("height").Expression = "isolate(" & GoExcel.CellValue("F" & i) & ";in;in)" oPars.Item("thk").Expression = "isolate(" & GoExcel.CellValue("E" & i) & ";in;in)" xDoc.Save xDoc.Close(True) For k = 1 To GoExcel.CellValue("I" & i) oAssyDoc.ComponentDefinition.Occurrences.Add(oooFolder & GoExcel.CellValue("A" & i) & " " & sNewName & ".ipt", oPos) Next k Next i
I have this block of code which is used to generate parts based on a spreadsheet. One of my columns is a list of different materials. The pink section of my code is meant to read this column and update the material accordingly. My issue is: the first instance of a new material is set incorrectly, matching the previous material. The following instances are correct.
Here's an example:
The column for material reads as follows:
1. ABS
2. ABS
3. ABS
4. ABS
5. Acrylic
6. Acrylic
7. Acrylic
8. ABS
9. ABS
10. ABS
When the parts are created, part 1 will default to Polycarbonate (which the template file is set to initially), part 5 will be set to ABS, part 8 will be Polycarbonate, and the rest are correct.
If anyone knows what's going on please let me know! Any help would be greatly appreciated!