Message 1 of 6
SaveItemOverridesToBOM Bug?
Not applicable
09-10-2008
01:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to make a macro that adds the vendor column to the end of a parts list, sort by it first, then by part number, renumber the parts list, then save the overrides to the BOM. Everything works great except for saving the overrides to the BOM. The item number sort order gets jumbled back up. I am using Inventor 2008 Pro SP2. Below is the code:
Public Sub SortPartsList()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oPartsList As PartsList
Set oPartsList = oDoc.ActiveSheet.PartsLists.Item(1)
Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
Dim oPropSet As PropertySet
Set oPropSet = oPropsets.Item("Design Tracking Properties")
Dim found As Boolean
found = False
Dim j As Long
For j = 1 To oPartsList.PartsListColumns.Count
If LCase(oPartsList.PartsListColumns.Item(j).Title) = "vendor" Then
found = True
End If
Next
If found = False Then
Call oPartsList.PartsListColumns.Add(kFileProperty, oPropSet.InternalName, oPropSet.Item(15).PropId)
End If
Call oPartsList.Sort("VENDOR", True, "PART NUMBER", True)
oPartsList.Renumber
oPartsList.SaveItemOverridesToBOM
End Sub
Public Sub SortPartsList()
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oPartsList As PartsList
Set oPartsList = oDoc.ActiveSheet.PartsLists.Item(1)
Dim oPropsets As PropertySets
Set oPropsets = oDoc.PropertySets
Dim oPropSet As PropertySet
Set oPropSet = oPropsets.Item("Design Tracking Properties")
Dim found As Boolean
found = False
Dim j As Long
For j = 1 To oPartsList.PartsListColumns.Count
If LCase(oPartsList.PartsListColumns.Item(j).Title) = "vendor" Then
found = True
End If
Next
If found = False Then
Call oPartsList.PartsListColumns.Add(kFileProperty, oPropSet.InternalName, oPropSet.Item(15).PropId)
End If
Call oPartsList.Sort("VENDOR", True, "PART NUMBER", True)
oPartsList.Renumber
oPartsList.SaveItemOverridesToBOM
End Sub