Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a function that is intended to find a given part and change the item number. I'm using it to renumber the BOM in a very specific order. The order is currently correct, however my assemblies use virtual parts. My current bit of code when checking the BOM can't find virtual parts because they simply show up as the assembly name. I've tried checking BomRow.PartNumber, but apparently partnumber isn't a member of the bomrow which was a tad unexpected.
Can anyone modify this to account for virtual parts?
Thank you,
Thomas Long
'Changes item number of part given to specified item number '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Function BomNumber(PartName As String, Item As Integer) Dim oAsm As AssemblyDocument Dim oBom As BOM Dim oBomRows As BOMRowsEnumerator Dim oBomRow As BOMRow Dim oBomView As BOMView Dim oDef As ComponentDefinition Dim PartNumber As String oAsm = ThisDoc.Document oBom = oAsm.ComponentDefinition.BOM oBomView = oBom.BOMViews("Structured") oBomRows = oBomView.BOMRows oBom.StructuredViewEnabled = True oBom.StructuredViewFirstLevelOnly = False For Each oBomRow In oBomRows oDef = oBomRow.ComponentDefinitions(1) PartNumber = oDef.Document.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")("Part Number").Value If PartName = PartNumber Then oBomRow.itemNumber = Item Next End Function '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Solved! Go to Solution.