Reorder parts list columns

<?xml encoding=”UTF-8″>By Adam Nagy

If you want to change the order of the columns of the PartsList object then you can use the PartsListColumn.Reposition function for that. Here is a VBA sample that reverses the order of the parts list columns:

Sub ReorderPartsList()
' The parts list whose columns you want to reorder
' needs to be selected in the User Interface
Dim doc As DrawingDocument
Set doc = ThisApplication.ActiveDocument
Dim pl As PartsList
Set pl = doc.SelectSet(1)
Dim plcs As PartsListColumns
Set plcs = pl.PartsListColumns
' We'll simply reverse the order of the columns
Dim i As Integer
For i = 1 To plcs.count - 1
Dim plc As PartsListColumn
Set plc = plcs(1)
Call plc.Reposition(plcs.count - i + 1, False)
Next
End Sub

Reorder

 


Comments

5 responses to “Reorder parts list columns”

  1. Hello Adam,
    is it possible to sort it for example:
    QTY, Item, Author …
    Thank you
    Mike

  2. Hi Mike,
    You can sort it any way you want based on the name of the columns.
    Cheers,
    Adam

  3. Hello Adam,
    I am new to the iLogic world and could possibly use your assistance with the Reorder parts list columns rule that you posted on 10/6/14. I am using a parts list that has multiple quantity sections. These are derived from an I assembly that I created. To make a long story short the quantity columns come in, in the wrong order and I have to manually go in and rearrange them every time. I tried to copy your code above to see if any of my parts list would reorder and it kept giving me an error. I have plenty of screen captures that I could send you for more detail. Please let me know if you are able to assist me on this.

  4. Hi James,
    The best would be if you could log this on the Inventor API forum where you could also upload the relevant files.
    http://forums.autodesk.com/t5/inventor-customization/bd-p/120
    Cheers,
    Adam

  5. Murugan Avatar
    Murugan

    Hi Adam,
    How to add columns like material, mass etc..
    Thanks,
    Murugan

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading