BOM Sort not working Properly

BOM Sort not working Properly

Anonymous
Not applicable
3,247 Views
11 Replies
Message 1 of 12

BOM Sort not working Properly

Anonymous
Not applicable

Dim oDrawDoc As DrawingDocument

    Set oDrawDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet

    Set oSheet = oDrawDoc.ActiveSheet

    Dim oDrawingView As DrawingView

    Set oDrawingView = oSheet.DrawingViews(1)

   

   Dim oAssydoc As AssemblyDocument

   Set oAssydoc = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument

  

   Dim oBOM As BOM

   Set oBOM = oAssydoc.ComponentDefinition.BOM

  

   oBOM.StructuredViewEnabled = True

   oBOM.StructuredViewFirstLevelOnly = False

  

   Dim oBOMView As BOMView

   Set oBOMView = oBOM.BOMViews.Item("Structured")

   

   Call oBOMView.Sort("BOM Structure", True, "Part Number", True, , True)

The above line not working properly, It sorts only the first a criteria i.e. BOM Structure. And if change the first one to Part Number the only the part number will work. At any point of time only the first sorting criteria is working.

 

Accepted solutions (1)
3,248 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable

Is this a bug or something wrong in the above code?

0 Likes
Message 3 of 12

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

firstly, there is a typo in the last line. The TertiaryColumnTitle  is not set, while the TertiaryColumnAscending is set to true.

 

But this is not a problem. Even though I use Call oBOMView.Sort("BOM Structure", True, "Part Number", True), the issue can reproduce. The second column is not sorted.

 

I logged this issue with the engineer team.

Message 4 of 12

Anonymous
Not applicable

Thanks, Please Let me know if this is solved in upcomming updates.

0 Likes
Message 5 of 12

Anonymous
Not applicable

The problem exists in Inventor 2014 also.

Message 6 of 12

jdkriek
Advisor
Advisor

Good catch.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 7 of 12

mrattray
Advisor
Advisor
Still an "issue" in Inventor 2015.
Mike (not Matt) Rattray

0 Likes
Message 8 of 12

MechMachineMan
Advisor
Advisor

STILL an issue in 2016, 4 years later.

 

ie; Trying to sort BOM with a custom iProp column (Work Order #) sorted first, and mass sorted second.

 

Will sort mass just fine, but I can't set the option for what order to sort the custom iProp; it always sorts ascending even though it is completely numerical..


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 9 of 12

Anonymous
Not applicable

Still an issue in Inventor Pro 2017.... Can someone please fix this?!

Message 10 of 12

Anonymous
Not applicable

There is a way to sort BOM by more then one column:

 

Instead of trying to do it this way:

oBOMView.Sort("BOM Structure", True, "Part Number", True)

 

Do it this way: first sort by the second column and then by the first.

 

oBOMView.Sort("Part Number", True)

oBOMView.Sort("BOM Structure", True)

 

 

0 Likes
Message 11 of 12

Anonymous
Not applicable

There is a way to sort BOM by more then one column:

 

Instead of trying to do it this way:

oBOMView.Sort("BOM Structure", True, "Part Number", True)

 

Do it this way: first sort by the second column and then by the first.

 

oBOMView.Sort("Part Number", True)

oBOMView.Sort("BOM Structure", True)

0 Likes
Message 12 of 12

rhasell
Advisor
Advisor

Hi

Actually, this never works properly. You might get lucky, but don't bank on it. I guess it depends on your environment, but I had some strict sorting rules, and they never really worked consistently.

 

I have found that sorting in the drawing environment to be the most stable.

Create a dummy drawing and place all the Parts Lists in there. Using iLogic, you can sort multiple parts lists with a few mouse clicks.

These can then write back to the assemblies, and give a consistent BOM sort. (I wrote some code the other day to sort the BOM by item number, you cant go wrong with that one, LOL)

 

Reg
2026.1
0 Likes