Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Order BOM based on part number (not alphabetical)

6 REPLIES 6
Reply
Message 1 of 7
mat_hijs
389 Views, 6 Replies

Order BOM based on part number (not alphabetical)

I'm building yet another configurator and I'm looking for a way to order my BOM after the configuration is done. I want the BOM to be ordered by part number, but not alphabetically. I want to order the components in the order that they will be used during fabrication.

To give an example, the aluminum profile will always be the starting point and the part number will start with "150 ST A". The next components could be some gaskets which can have different part numbers, but I have a list of possible part numbers. The order between these gaskets is not important. This goes on until all components are listed.

I'm not really sure how to tackle this. Does anyone have some suggestions?

6 REPLIES 6
Message 2 of 7

Start with adding a custom property to each individual part and assembly, "ordernr" for example.
You know the criteria for each part and assembly on forehand already.
If this is done you can sort them by this number.

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Message 3 of 7

this would definitely be a good option, however I'm dealing with a lot of content center parts. I was hoping for a way to go about this without having to change all those families because that would be pretty time consuming. I have been considering instance properties because that could be done at the assembly level without changing the original components but I haven't played around with those yet and I'm not sure how well this would work.

Message 4 of 7
A.Acheson
in reply to: mat_hijs

It sounds like you want to organize by category?. The BOM isn't the place to perform this sequencing or order of priority. It is too rigid especially if you don't want to touch existing content center parts or you have parts/assemblies used in different projects etc. The sort tool isn't fantastic either. Best of do this in the parts list where you have full editing capabilities for each part and the information / criteria only exists in the drawing.  If you want to permanently store this then store it in the assembly/document like @bradeneuropeArthur suggested. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 5 of 7

You could use "instance properties" to do this with Content Center Parts.

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Message 6 of 7
Michael.Navara
in reply to: mat_hijs

If you want to sort BOMView with your own rules, you can do it with your own IComparer implementation. See the Sub Main() comments which describes the required steps.

!!! Be careful !!!

  • The last step to sort bom rows is culture specific. Because Sort method requires column display name which is different for each Inventor localization
  • This sample expects the "Structured" bom view is enabled.

 

Sub Main()

    'Get assembly BOMView
    Dim asm As AssemblyDocument = ThisDoc.Document
    Dim bomView As BOMView = asm.ComponentDefinition.BOM.BOMViews(2)

    'Convert BOMRows to custom List of BOMRows
    Dim bomRowsList As List(Of BOMRow) = bomView.BOMRows.OfType(Of BOMRow).ToList()

    'Sort the list as you want
    bomRowsList.Sort(New MyBomRowComparer)

    'Adjust ItemNumbers to store the rows order
    Dim rowNumber As Integer = 1
    For Each row As BOMRow In bomRowsList
        row.ItemNumber = rowNumber
        rowNumber += 1
    Next

    'Finally sort the rows by ItemNumber
    'bomView.Sort("Položka") 'Czech
    bomView.Sort("Item") 'English
    
End Sub

Class MyBomRowComparer
    Implements IComparer(Of BOMRow)

    Public Function Compare(row1 As BOMRow, row2 As BOMRow) As Integer Implements IComparer(Of BOMRow).Compare
        'Implement you own rows comparison

        'This sample compares component definition type.
        Dim r1Type As Integer = CInt(row1.ComponentDefinitions(1).Type)
        Dim r2Type As Integer = CInt(row2.ComponentDefinitions(1).Type)
        Return r1Type.CompareTo(r2Type)
    End Function
End Class

 

Message 7 of 7
A.Acheson
in reply to: Michael.Navara

Thanks for sharing Michael this type of BOM Comparer would come in handy for complex BOM sorts,

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report