After some rooting around, I can't seem to find any literature in the 2020 SOLIDWORKS API Help - SOLIDWORKS Document Manager API Help with respect to Exporting a BOM Table - specifically .SLDDRW BOM Table. I hope I'm missing something, as the ability to not have to open the drawing document would be pretty slick.
Possible workaround that I have found is (roughly):
GetDocument Method as ISwDMDocument
→ GetTableNames from ISwDMDocument as Variant (SwDmTableType.swDmTableTypeBOM)
→ GetTable Method from ISwDMDocument as ISwDMTable (using first instance of Table Name in my case)
From there I can get some good information like column/row count and get/set cell text from ISwDMTable Interface Members. One could then approach the BOM generation similarly to Excel macro to manage custom properties in SOLIDWORKS files within Excel (UDF). This would presumably involve table creation in Excel that matches the row/column count, then reads each corresponding cell text. Should work in theory - right?
My main questions:
- Is anyone aware of a out-of-the-box .SLDDRW BOM Table Export function within the Document Manager API?
- Does the workaround seem like a decent approach, or can you see any potential issues?
- Thinking headers, hidden rows, overwritten values, etc.