Inventor Customization

Reply
New Member
ges87
Posts: 2
Registered: ‎04-27-2012
Message 1 of 3 (482 Views)

Export drw BOM (parts list) to excel

482 Views, 2 Replies
04-27-2012 06:31 AM

Hi.

I have a drawing with multible sheets (spool drawings) all with there owne parts list and I need to export them all to excel. This takes a long time when you have 100 sheets. So my question is how can I doo this, how should the code look like?

 

Distinguished Contributor
achmidt
Posts: 130
Registered: ‎07-21-2011
Message 2 of 3 (478 Views)

Re: Export drw BOM (parts list) to excel

04-27-2012 08:06 AM in reply to: ges87

Try this code below as a start, you may need to create a loop for sheets.

 

'Export PartsList

 

path_and_name = ThisDoc.PathAndFileName(False) ' without extension

 

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

 

'skip error in case no parts lists exist

On Error Resume Next

oPartslist1 = oSheet.PartsLists(1)

oPartslist2 = oSheet.PartsLists(2)

 

Dim oCol As Long

For oCol = 1 To oPartsList1.PartsListColumns.Count

 

'find the parts list that contains the LibRef column

If oPartslist1.PartsListColumns.Item(oCol).Title  = "LibRef" Then

' export the Partslist to Excel.

oPartslist1.Export(path_and_name & ".xls",PartsListFileFormatEnum.kMicrosoftExcel)

Else

oPartslist2.Export(path_and_name & ".xls",PartsListFileFormatEnum.kMicrosoftExcel)

End If

Next

Inventor Virtual Parts Addin

http://apps.exchange.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3Avirtualpartsadd-in_windows32and64%3Aen
New Member
ges87
Posts: 2
Registered: ‎04-27-2012
Message 3 of 3 (456 Views)

Re: Export drw BOM (parts list) to excel

05-01-2012 11:13 PM in reply to: achmidt

hi. thanks for the respons. But i cant get this to work. It does not create the file. I have tried many different codes but they never manage to create the excel file.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube