Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there,
Can someone look at my code below and able to tell me why it doesn't recognize the Virtual Part Numbers?
Dim oBOM As BOM = ThisAssembly.Document.ComponentDefinition.BOM
'Make sure the views are enabled
oBOM.StructuredViewEnabled = True
Dim MyArrayList As New ArrayList
MyArrayList = GoExcel.CellValues("C:\Users\XXXXX\Documents\Inventor iLogic External Rules\5066 Part Numbers.xlsx", "Sheet1", "A1","B2175")
oRowStart = 2 'first row check
oRowEnd = 2175 'lat row check
'get info from the XLS file
For MyRow = oRowStart To oRowEnd 'index row 2 through 200
'Primary Head
partNUMBER = GoExcel.CellValue("B" & MyRow)
itemNUMBER1 = GoExcel.CellValue("A" & MyRow)
For Each oBOMRow As BOMRow In oBOM.BOMViews.Item("Structured").BOMRows
If oBOMRow.ComponentDefinitions(1).Document.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value.Contains(partNUMBER) Then
oBOMRow.ItemNumber = itemNUMBER1
End If
Next
Next
'[
Dim doc As Document = ThisDoc.Document
Dim partslist As PartsList
Dim aDoc As AssemblyDocument
If (doc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject) Then
Dim dDoc As DrawingDocument = ThisDoc.Document
partslist = dDoc.ActiveSheet.PartsLists.Item(1)
aDoc = partslist.ReferencedDocumentDescriptor.ReferencedDocument
Else If (doc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject) Then
aDoc = doc
Else
Return
End If
If (aDoc.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject)
Return
End If
Dim BOM As BOM = aDoc.ComponentDefinition.BOM
BOM.StructuredViewEnabled = True
Dim oBOMView As BOMView = BOM.BOMViews("Structured")
oBOMView.Sort("Item", True,)
oBOMView.Renumber(1, 1)
']
Solved! Go to Solution.