Jamie Lohrberg

How to load BOM Table Sort Data through SolidWorks API?

Discussion created by Jamie Lohrberg on Aug 29, 2019
Latest reply on Sep 11, 2019 by Jamie Lohrberg

Hi all,

 

I am currently developing a SolidWorks add-in that automatically generates drawings. On each drawing, I am placing a BOM table annotation in the upper-right corner of the sheet. The BOM table annotation I am using is loaded from a SLDBOMTBT file that has been saved with a pre-existing sort order.

 

When a new drawing is generated during the automatic process, I use the SolidWorks API’s InsertBomTable4(…) function to place the table annotation in the drawing. After placing the annotation, I then call the GetBomTableSortData(…) function to retrieve the existing sort data of the BOM table, since this will be required as a parameter for the ApplySavedSortScheme(…) function I later call to actually sort the table.

 

Through debugging, it appears that the GetBomTableSortData(…) function does not fully load the BOM table sort data previously saved in my SLDBOMTBT file. The value returned from the GetBomTableSortData(…) function is a BomTableSortData object, however, the ItemGroups property of the object is NULL.

 

Does anyone know of an alternative SolidWorks API function or workaround to properly load the saved sort data from an existing SLDBOMTBT file template?

 

As a side note, I have written temporary logic to create the sort data and set the ItemGroups integer array following the InsertBomTable4(…) function and this does work. The GetBomTableSortData(…) function will return my sort data with static ItemGroups when I have first set the value moments before. Unfortunately, this does not solve my problem though since I’d like to load the sort data settings from the SLDBOMTBT file so that when sort values change, I do not need to adjust and recompile my SolidWorks add-in DLL.

 

Thank you in advance for any and all suggestions!

Outcomes