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: 

BOM Sort not working Properly

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
saseendrankombath
2818 Views, 11 Replies

BOM Sort not working Properly

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.

 

11 REPLIES 11
Message 2 of 12

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

Message 3 of 12

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

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

Message 5 of 12

The problem exists in Inventor 2014 also.

Message 6 of 12
jdkriek
in reply to: saseendrankombath

Good catch.

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


Message 7 of 12

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

Message 8 of 12
MechMachineMan
in reply to: mrattray

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
Tags (1)
Message 9 of 12
foxrid3r
in reply to: MechMachineMan

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

Message 10 of 12
jaro_farkas
in reply to: foxrid3r

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)

 

 

Message 11 of 12

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)

Message 12 of 12
rhasell
in reply to: jaro_farkas

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
2024.2
Please Accept as a solution / Kudos

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

Post to forums  

Autodesk Design & Make Report