Hi All,
I've recently completed a script to re-number the part numbers of an assembly and changes the part numbering to a semi smart system following a system of
A-01 (is made of)
[P-01-01
P-01-02
P-01-03
A-02
A-05]
A-02 (is made of)
[P-02-01
P-02-02
A-03
A-04]
A-05 (is made of)
P-05-01
P-05-02
P-05-03
The loose format of the script is as
Dim BOM As BOM = Doc.ComponentDefinition.BOM
Dim BomView As BOMView = BOM.BOMViews.Item(1)
For i As Integer = 1 To BOMRows.Count
'Get the current row
Dim Row As BOMRow = BOMRows.Item(i)
'Reference to the primary component definition of the Row
Dim CompDef As ComponentDefinition = Row.ComponentDefinitions.Item(1)
Following on from here are a number of conditions that identify parts that belong to different groups and schemes.
The script works as intended; however I have found a minor bug in that there are times I would like to change the order of items in the BOM, i.e. in the example above I would like for A-05 to be above A-02 and be numbered first, or in the somewhat trivial example I would like to change the order of P-01-01 & P-01-02. Note there's no explicit rule right now for how I want to do this, it's more due to how I structure my drawings.
I've attempted to go into the BOM, drag the rows to where I'd like them to be, saving out and then re- running the script, however it doesn't seem to work. I've tried this in both the model data and the structured BOM with no results. Any assistance would be appreciated
Kind Regards
Roydon Mackay