×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Importing BOM from .SLDASM into Excel

Importing BOM from .SLDASM into Excel

Importing BOM from .SLDASM into Excel

(OP)
Summary: I wish to automatically obtain the Bill of Materials (BOM) from a SolidWorks assembly file (.SLDASM) and import it into Excel.


I'm somewhat familiar with VBA. I have an Excel file with a list of file location and file names. From here I want to create a connection to SolidWorks (via ADO/DAO? not sure how to do this) and extract the BOM information from the assembly and import it into Excel. There would be no need to physically open up the assembly, just create the connection and export the BOM information.

Thanks in advance!

RE: Importing BOM from .SLDASM into Excel

this may help you get started.
Lenny's AssemblyBOM macro  thread559-158093

cheers
SW07-SP3

RE: Importing BOM from .SLDASM into Excel

Quote:

There would be no need to physically open up the assembly, just create the connection and export the BOM information.

By this, do you mean that you don't want to have to load the assembly into ram at all, or do you mean that you just don't want to have it come up on the screen?  I don't think BOM information is available without opening the assembly because the BOM is built dynamically from the assembly.

ADO: ActiveX Data Objects
DAO: Data Access Objects

Neither of these will give you access to information in a SolidWorks file.  Only SolidWorks (or to a limited extent, SolidWorks Explorer) can access data in a SolidWorks file.  It would be possible to automate SolidWorks using COM to open the assembly, traverse it, and build your own BOM from that data.  However, unless you've seriously understated your familiarity with VBA (and the SolidWorks API in particular), I would say that what you've stated that you want to do will require a lot more assistance than it's possible to give in a web forum.

RE: Importing BOM from .SLDASM into Excel

(OP)
Wow thanks, this definitely looks very useful.

Unfortunately I guess my VBA knowledge really isn't that great... This macro requires that I run it from SolidWorks. Anyone by any chance know how to get started from Excel?

RE: Importing BOM from .SLDASM into Excel

(OP)
Ah, thanks for the info handleman. I'll rethink this some more.

RE: Importing BOM from .SLDASM into Excel

(OP)
Okay, I guess this is what I have in mind:

Assuming I have a list of Path + File names of assembly drawings in Column A in an Excel file:

Set swApp = CreateObject("SldWorks.Application")
For i = 1 to Range("A65536").End(xlUp).Row
  PathName = Cells(i, 1).Value
  Set swPart = swApp.OpenDoc(PathName, swDocDrawing)

  'Somehow extract BOM information and export to Excel.
Next i

Can be changed to open Assembly instead of Drawings if that's easier. I'm not sure how BOM information is stored exactly

RE: Importing BOM from .SLDASM into Excel

BOM is not stored in an assembly (SLDASM). You will have to traverse the assembly and extract the properties from each component, one by one. Look again at the answer you got from CBL.

RE: Importing BOM from .SLDASM into Excel

Ah, stupid question........why not dump the assembly into a drawing and insert an Excel BOM from there. You can then save it outside SW and then add the doc in design binder in the assembly.

Macduff spin
Colin Fitzpatrick
Mechanical Design Engineer
Solidworks 2007 SP 2.2
Dell 390 XP Pro SP 2
nVida Quadro FX 3450/4000



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources