iLogic to Export BOM from Assembly to an excel template

iLogic to Export BOM from Assembly to an excel template

RNDinov8r
Collaborator Collaborator
3,029 Views
6 Replies
Message 1 of 7

iLogic to Export BOM from Assembly to an excel template

RNDinov8r
Collaborator
Collaborator

As a general rule, we do hand written requisitions for 1 or 2 parts that need to be purchased or manufactured in house. However, as of late, we are seeing larger projects come through, and we release sub assemblies, rather than the entire machine for procurement/manufacture. I have a BOM workflow set up for full assemblies, however, it can be quite time consuming if I use this process for 15 or 20 sub assemblies as well as creating lots of extraneous drawings.  I have a requisition template in Excel that I would like to directly export an Assembly (.iam) BOM to...however, I have not seen where anyone else has done this without using the intermediate step of exporting a parts list from a drawing. I know that there is a BOM export function in iLogic, it is not apparent to me how to tie this in with pointing it at my excel template (and describing which iProperties to import as well). Has this been done? I have not had luck finding any forums describing this method.

 

Ideally, I would like an iLogic rule that i can save in our base Assembly template file, so I can do this export from any assembly I create going forward.

0 Likes
Accepted solutions (1)
3,030 Views
6 Replies
Replies (6)
Message 2 of 7

MechMachineMan
Advisor
Advisor

What does the template you want information to go into look like?

 

There's definitely ways to do this, but it all depends on what information you want in the end.

 

For ex, if you want all info present as a structure BOM, you can export that to an excel file then go into the excel file and sort the columns so they appear in the right order all through a single vb.net/vba procedure.


--------------------------------------
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
0 Likes
Message 3 of 7

RNDinov8r
Collaborator
Collaborator

I would be importing data into field A25 and then going down and to the right from there. There is other information that would need to be filled out, so I have an idea for macros in excel for some things. I have a template that differs greatly that I export from a BOM .idw file I create for our top level models, but that is not meant to be printed out and "handed" to the purchasing department.

 

Here, the only columns I would be utilizing are for Qty, Part Number, Title (which we call Desciption), and Vendor.

0 Likes
Message 4 of 7

HermJan.Otterman
Advisor
Advisor

hello,

 

 

 

here is a piece of code I used for some thing like that.

to make this correct, you have to do some coding, but I hope this will help you.

 

first I make a partlist in a new drawing, from the assembly I want. this way I can set my preferences for the partlist.

after that I export it to an excel template,

 

(you have to make some modifications !!, this is in VB.net, _inventorApplication = thisapplication)

 

so first the creation of the partlist in 2D:

 

Private Function CreatePartList(ByVal oAssyDoc As Inventor.AssemblyDocument) As Inventor.DrawingDocument

 

'create new drawing

Dim oDrawDoc As Inventor.DrawingDocument = _inventorApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, _DrawingTemplate, False)

'make partlist (view not needed), but only a point to place the partlist

Dim oSheet As Inventor.Sheet = oDrawDoc.Sheets(1)

Dim oPlacementPoint As Point2d

oPlacementPoint = _inventorApplication.TransientGeometry.CreatePoint2d(oSheet.Width, oSheet.Height)

Dim oPartList As Inventor.PartsList

oPartList = oSheet.PartsLists.Add(oAssyDoc, oPlacementPoint, PartsListLevelEnum.kPartsOnly)

Return oDrawDoc

End Function

 

second part is for the export of this partlist:

 

Private Sub ExportPartListToExcel(ByVal oAssy As Inventor.AssemblyDocument, ByVal Partlist As Inventor.PartsList)

Dim oFileName As String = "Export_" & oAssy.DisplayName

Dim oExtension As String = ".xls" 

 

'create a new NameValueMap object for option

Dim oOptions As NameValueMap = _inventorApplication.TransientObjects.CreateNameValueMap

 

oOptions.Value("Template") = _ExcelTemplate    'this _ExcelTemplate is the path

'specify the start cell

oOptions.Value("StartingCell") = _ExcelStartingCel   'this _ExcelStartingcel is for example A2

'export

Partlist.Export(oFullFileName, PartsListFileFormatEnum.kMicrosoftExcel, oOptions)

End Sub

 

 

 

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


0 Likes
Message 5 of 7

RNDinov8r
Collaborator
Collaborator

So is this process creating a new .idw that has to be saved, or is it a "work around/place holder" in order to get the parts list to export the information to Excel from?

 

Generally, I am trying to avoid creating ANOTHER drawing.

0 Likes
Message 6 of 7

HermJan.Otterman
Advisor
Advisor
Accepted solution

that is correct, I create an other drawing, but only in memory to get the partlist that I want. and for that I use an .idw template that has the correct partlist formatting that I want, So the export to the excel template goes well.

I don't save this drawing, it is only in memory, but I have to have a drawing template file, and also an excel template file.

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan


Message 7 of 7

Anonymous
Not applicable

I need to export all levels of  a structured BOM

 

I have modified your code here:


oPartList = oSheet.PartsLists.Add(oAssy, oPlacementPoint, PartsListLevelEnum.kStructuredAllLevels)

 

Although I believe another step is required to expand the nodes to include all children, is this possible through the API?

0 Likes