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: 

Re-post - iLogic to Sort the BOM

3 REPLIES 3
Reply
Message 1 of 4
rhasell
1362 Views, 3 Replies

Re-post - iLogic to Sort the BOM

Hi all

 

Please don't flame me, this is a re-post from the "customization Board"

 

I have been searching the forum for a while now, but have been unable to find any code to sort the BOM, there are lots of snippets to sort and modify the Parts list. (Curtis Wageuespackhas done a lot on this)

 

Does anyone have something to sort the Assembly BOM?

Any help will be appreciated.

 

Thank you.

 

Sort parameters:

PARTS Only

 

"BOM Structure"

     then by

Custom Parameter "TYPE"

     Then By

Part Number

 

Then "Renumber" starting at 1

bom-sort.JPG

 

 

Reg
2024.2
Please Accept as a solution / Kudos
3 REPLIES 3
Message 2 of 4
rhasell
in reply to: rhasell

Hi there

 

I have been playing around a bit and have managed to get the BOM to sort on one item list only. Can someone perhaps debug my code and help with the multiple sort?

 

I have commented out the WORKING string, the one that I need is just above it.

 

Thanks guys.

 

' Set a reference to the assembly document.
' This assumes an assembly document is active.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument

Dim SortBOM As Boolean
If MsgBox("Sort The BOM?", vbYesNo) = vbYes Then
SortBOM = True
Else
SortBOM = False
End If

' Set a reference to the BOM
Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM

' Set whether first level only or all levels.
If SortBOM Then
oBOM.PartsOnlyViewEnabled = True
Else
Return
'oBOM.PartsOnlyViewEnabled = False
End If

' Make sure that the structured view is enabled.
oBOM.PartsOnlyViewEnabled = True
'Set a reference to the "Structured" BOMView
Dim oBOMView As BOMView
oBOMView = oBOM.BOMViews.Item("Parts Only")

'Sort the BOM
Call oBOMView.Sort("BOM Structure",True,"TYPE",True,"Part Number",True)
''The following line works correctly
'Call oBOMView.Sort("Part Number",True)
'Re-Number the BOM
Call oBOMView.Renumber(1, 1)

 

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 3 of 4
SoulAsasin
in reply to: rhasell

Hello

 

i had the exact same problem. It would not sort on 3 criteria.

 

Talked to one of our trainers, and he told me this is an inventor error.

 

What i am doing is sortin and exporting the part list on the drawing (sorting works on the drawing sheet). After this i override the assy BOM from the drawing and reorder it depending on ITEM.

 

I dont have the filan code yet, but i know it works. Tested part of code.

 

Offcourse if you do not have a drawing yet, then this is not good. In my situation I always have a drawing.

 

If you want i can send you my code wheen i am done...

 

Hope this helps.

Inventor 2012
Win 7 64-bit
Dell Precision T5400
Intel Xeon 2,5 GHz
8 Gb RAM
NVIDIA Quadro Fx 3700
Message 4 of 4
SoulAsasin
in reply to: SoulAsasin

Hey

 

I managed to make it work.

 

Look at the following thread

 

http://forums.autodesk.com/t5/inventor-customization/ilogic-assy-bom-sort-by-3-columns/m-p/5397643/t...

 

If you need any more help please tell...and dont forget to mark as solution if it's ok.

 

Thanks

Inventor 2012
Win 7 64-bit
Dell Precision T5400
Intel Xeon 2,5 GHz
8 Gb RAM
NVIDIA Quadro Fx 3700

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

Post to forums  

Autodesk Design & Make Report