Reply

Extract BOM from .ASM file with API

Hi, I am writing a tool in Visual Basic.  I would like to be able to extract the BOM from a Solid Edge ssembly file probably with an API without having to open Solid Edge.  I found a Solid Edge API document (.NET Programmer's Guide - Solid Edge with Synchronous Technology API) that shows how to extract things such as the file properties using the Solid Edge File Properties Object Library API and that works well, but the document does not describe how to extract a BOM.  I've read somewhere that it can be done with the Revision Manager API but can't find any details on how to do it.  Any help is much appreciated.  Thanks.

 

 

6 REPLIES

Re: Extract BOM from .ASM file with API

Hi Lance, Welcome to the SE Developer forum.

You are right. The Revision Manager API can be used to extract a BOM from a Solid Edge assembly file.

 

A small code snippet which uses recursive programming to traverse the assembly is here.

 

If you want a detailed worked out code, have a look at the Pack and Go open source program which can be accessed from this external link.

 

Hope you find this useful.

 

BR,

Tushar Suradkar

www.SurfAndCode.in

 

Re: Extract BOM from .ASM file with API

See my reply to this post.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: Extract BOM from .ASM file with API

Jason, thanks.  I downloaded your source code for ExtractStructure (VB) and opened in Visual Studio Express 2013.  I did Add Reference to the Solid Edge Revision Manager Object API.  Then I was able to get past the NuGet error (although, I'm not sure what that is yet).  But I ran the program and nothing happened (no windows forms came up).  Is the code just functions to use in another program?

 

I'm not sure what the NuGet is for and the JSON and JSON convert and serializing the data.

I am just trying to first read the top level BOM of an .ASM file.  Can you point to a piece of your code (a function) that just reads the top level?  The code is more complicated than I need right now such that it's difficult to understand.

 

Thanks.

Re: Extract BOM from .ASM file with API

Jason, also, I don't see where to enter the filename of the ASM file I am trying to get the BOM for.  Thanks.

Re: Extract BOM from .ASM file with API

When I run the Extract Structure VB program, a command window comes up for just a second and disappears, then the program stops.  Is that what is supposed to happen?

 

Then a bunch of warnings in the Output window in Visual Studio such as:

 

ExtractStructure\bin\Debug\SolidEdge.Community.dll'. Cannot find or open the PDB file.

ExtractStructure\bin\Debug\Interop.SolidEdge.dll'. Cannot find or open the PDB file.

ExtractStructure\bin\Debug\Newtonsoft.Json.dll'. Cannot find or open the PDB file.

\CustomMarshalers.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

\System.Numerics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

 

 

Re: Extract BOM from .ASM file with API

For issues with NuGet, watch my How to use NuGet video. The RevisionManager API is not used in the sample you noted so it makes no sense that adding that reference manually fixed anything. I recommend that you look at the ExtractBOM sample instead. The sample is a console application that connect to Solid Edge and the active document. If the active document is an Assembly, it will traverse the structure and produce a BOM. You have to set breakpoints and debug the code to understand what it's doing. No files are produced but I do demonstrate serializing the BOM into a JSON string and tabbed delimited string. The sample is simply a demonstration of how to use the Solid Edge API to get a BOM. What you do with it is up to you.

Jason Newell
Applications Architect
www.jasonnewell.net