Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations SSS148 on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

BOM sort and renumber

Status
Not open for further replies.

hititfaster

Mechanical
Nov 24, 2010
185
Owing to a job change, I've transferred in from SolidWorks. Used the SW forum on here a bit but need some Inventor help now!

When creating a parts list on a drawing, I notice my item numbers are often out of sync. As part of our issuing procedure we:

- RMB on the view > Bill of Materials,
- Go to Structured,
- Highlight all and expand
- Sort by Part Number
- Renumber
- Repeat most of this for the Parts Only BOM.

Whilst in there we also have to output an Excel version of both BOM's for BOM department to process.

Doing this day in, day out is getting a bit tedious... Can I automate any/all of this? I'm afraid I have zero experience in iLogic or code, but some of the guys here possibly do so any pointers would be helpful.

The dream would be a button I can click, which expands, both BOM's, sorts, renumbers then exports an Excel of each to a set location (always the same). Am I dreaming or is this possible?


 
Replies continue below

Recommended for you

When dreams become reality... [2thumbsup]
This will sort the parts list by part number then renumber the parts list then save those overrides to the BOM.. Then export an excel file of the parts list..



Code:
'start of iLogic code----------------------------------------------------------------------------------
'sort parts list
On Error Resume Next
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1)
If Not oPartsList1 Is Nothing Then 
Call oPartsList1.Sort("PART NUMBER") 'sort by part number
oPartsList1.Renumber 'renumber the parts list
oPartsList1.SaveItemOverridesToBOM 'save overrides to BOM
End If

'------------------------------------------------------------------------------------------------------------
'-------------Export Parts List ------------------------------------------------
Dim oDoc As Inventor.DrawingDocument
oDoc = ThisDoc.Document

Dim oSheet As Inventor.Sheet
'oSheet = oDoc.Sheets(1) ' first sheet
oSheet = oDoc.Sheets("Sheet:1") ' sheet by name

' say there is a Partslist on the sheet.
Dim oPartslist As PartsList
oPartslist = oSheet.PartsLists(1)

' export the Partslist to Excel.

'folderName = "C:\temp" 'Excel file will be saved here or uncommend the line below
folderName = ThisDoc.Path
oPartslist.Export(folderName & "\Partslist.xlsx", PartsListFileFormatEnum.kMicrosoftExcel)

'----------------------------------
'---Display Message box that all is completed
MessageBox.Show("Parts List Sorted and Exported", "Sort-Export")
 
WOW - that's impressive! I need to learn how to perform this voodoo! What would you say is the best way to learn it? Are the Inventor tutorials good?

I'll have a play with getting this working for a start then perhaps when I start to understand how it works I can make adjustments to suit. Thanks very much for the help!
 
My "google foo" skills are strong grasshopper...
That and my "cut and paste" skills
and I "dabble" in some programming (microprocessors/web pages) so I can usually give it the brute force attack and get it to work..

I did not write that at all.. (I did add the message box at the end because it was just a silent process and I like to know it worked)..
There isn't much if any error checking but it should do the job..and did just fine when I tried it..

Curtis has some good simple tutorials on ilogic (He is my go to guy for ilogic.. he has written some great ones for me in the past)

Haven't seen any really good ones from Inventor other than blog posts from some of the "geeks" over there..
Well I guess they have some..

and just a FYI..
The Autodesk Inventor forums get much more "traffic" and eyes than on this board..but some of us do frequent here too..
The general board..
also customization board that has lots of coding examples/problems...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor