Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Insert BOM Table Example (VB)

Status
Not open for further replies.

rgrayclamps

Mechanical
Aug 6, 2004
376
Hi, API experts:

I noticed that the following code from "Insert BOM Table and Get Data Example (VB), Welcome to SolidWorks and Add-Ins API Help"

'**********************************************************

Set swBomTable = swView.InsertBomTable2(False, vPickPt(0), vPickPt(1), swBOMConfigurationAnchor_TopLeft, swBomType_TopLevelOnly, "", "")

'**********************************************************

only works when BomType is set to 1 (swBomType_PartsOnly) or 3 (swBomType_Indented). It does not work when BomType is set to 2 (swBomType_TopLevelOnly).

I am wondering if you guys experienced the same problem? Do you know what is wrong?

Thanks,

Alex
SW2005 sp02
WinXP sp1.0
 
Replies continue below

Recommended for you

I use this call in one of my routines to create a top-level BOM and it works fine. I did include the BOM template in the call though, where you just send an empty string. Try this:

Set swBomTable = swView.InsertBomTable2(False, vPickPt(0), vPickPt(1), swBOMConfigurationAnchor_TopLeft, swBomType_TopLevelOnly, "", "C:\Program Files\SolidWorks\lang\english\bom-standard.sldbomtbt")
 
Hi, Stoker:

Thanks for your reply! I intentionally omitted the BOM template in the call. When I tested the code, I did use my custom BOM plate.

But I got a bad new from SolidWorks API Support today. It says that this is an open issue. Here is a reply from SolidWorks API support today:

**********************************************************
"Unfortunately, this is an open issue. We have
SPR 278245 - View.InsertBomTable2 does not honor configuration passed in for top-level only type, creates empty table
"
(SolidWorks API Support)
**********************************************************

What is a disappointment! I almost got what I need to do (export BOM from SolidWorks drawing documents to my database automatically). But I think I can reconstruct "TopLevelOnly" BOM from "Indented" BOM.

Are you sure that you successfully used swView.InsertBomTable2 with swBomType_TopLevelOnly?

Thanks,

Alex
 
Yes, the statement I gave was pasted directly from my code and it works fine. I notice that you are on 2005. I am using 2006 SP1. Maybe that is the difference?
 
Hi, Stoker:

Thanks a lot!

I worked around this issue by reconstructing "TopLevelOnly" BOM from "Indented" BOM. For now, it works beautifully.

However, I am looking forward to using SW2006.

Alex

VB6.0
SW2005 sp02
WinXP sp1.0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor