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: 

Drawing Parts List renumbers Items when constructed programmically.

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
225 Views, 2 Replies

Drawing Parts List renumbers Items when constructed programmically.

I dump the master assembly parts list to provide a spreadsheet to our purchasing department.

However as the parts list may be in several segments (On separate sheets sometimes) I do not get the entire thing to dump.

 

To solve this issue I create a temporary blank sheet and add a temporary part list in full on it.

Since I am using it for dumping only I do not care if it stretches beyond the paper boarder.

 

This worked flawlessly in Inventor 2011 and 2014.  

In 2015 however the Item numbers appear to be alloted differently from the original parts list.

Tearing my hair out over this one.

 

 

2 REPLIES 2
Message 2 of 3
wayne.brill
in reply to: Anonymous

Hi,

 

I am not finding a known issue like this. Can you provide a code example and files that will allow me to research for a solution?

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
Anonymous
in reply to: wayne.brill

Sorry for not getting back sooner Wayne.

 

As stated before my program adds a temporary drawing sheet to my existing master drawing that contains the original parts list.

 

I add the parts list again to the temporary drawing sheet,  

modify cells for material export,

and dump it to an Excel workbook,

then destroy the temp sheet.

 

The workbook is sent to our purchasing department.  I do this so as not to modify the orignal parts list.

 

What I was doing in 2014 was using the driving master assembly document as a parameter to create the temporary parts list.

That process seems to renumber the items in 2015.    (Master.iam BOM vs Master.idw Parts list.)

 

I found a fix.  

From the original parts list I derive the driving ParentView.  

I use this ParentView as the parameter for the create parts list method.

I now end up with the items numbers as they should be.

 

--- Code Sample Follows ---

'...

 

Dim CurrDwg As Inventor.DrawingDocument
Dim CurrSheet As Inventor.Sheet
Dim CurrPartsList As Inventor.PartsList
Dim CurrView As Inventor.DrawingView

Set CurrDwg = ThisApplication.ActiveDocument
Set CurrSheet = CurrDwg.ActiveSheet
Set CurrPartsList = CurrSheet.PartsLists(1)
Set CurrView = CurrPartsList.ParentView

Set CurrPartsList = Nothing
Set CurrSheet = Nothing
Set CurrDwg = Nothing

sTempFile = DSIZE_TEMPLATE_FILE
Set oDwg = ThisApplication.Documents.Add(kDrawingDocumentObject, sTempFile, False)
Set oSheet = oDwg.Sheets.Add(kDDrawingSheetSize, kLandscapePageOrientation, "TempDSsize")

oSheet.Activate
ThisApplication.ActiveView.Fit
Set oTrans = ThisApplication.TransientGeometry

Set oPt = oTrans.CreatePoint2d(34 * 2.54, 22 * 2.54)

'====
'Set oPartsList = oSheet.PartsLists.Add(oMasterAssy, oPt, kPartsOnly)   'No longer works as of 2015

 

Set oPartsList = oSheet.PartsLists.Add(CurrView, oPt, kPartsOnly)   'Use this instead

'====


oMasterAssy.Update2 True


Set CurrView = Nothing

.

.

.

 

Call oPartsList.Export(sTargetFile, kMicrosoftExcel, "Materials")

 

To be honest I find the whole BOM vs Parts List connection confusing to say the least.

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

Post to forums  

Autodesk Design & Make Report