I have a group of assembly drawings where there are multiple part drawings contained inside a single drawing. I'd like to generate a list (spreadsheet) of drawings within a selected directory that lists each drawing's referenced parts with their part number. This would allow someone to search for a part determine which drawing it was included in. I considered just looking for BOMs, but some of the part lists in the drawings are cut lists. Is there an API for something like this?
SolidworksApi/macros
You could create a macro that:
- One by one opens each drawing in the folder
- Looks at all of the referenced part files
- Gets the part number from the custom properties of each part
- Adds the information to a CSV
CSV's are easier to write to that using the excel API, and can be opened by any spreadsheet software.
Check if this macro Macro to copy file paths to all drawings of an assembly components using SOLIDWORKS API by and modify for your needs.
is definitely right on using the Document Manager API. It'll make the application much faster.
Opening lots of files with the Solidworks API is much slower.
I believe you could use api for this but I would look into getting a license for Document Manager; this way you do not need to open the drawings.
Whether you write to a CSV file as suggested is a matter of what you are comfortable with. I have several macros that I write directly to and open session of excel.