We're looking to automate changes to Design Tables. We have an assembly with a Design Table, and multiple children have their own Design Tables.
We have a C# program that takes in a list of parameter values, and iterates through the assembly's BOM, opening Design Tables if they exist for the file and modifying values in the process.
Our problem is the changes made to the Design Table programmatically do not cause the same changes as if the tables were modified manually. Worse still, looking at examples online everyone's strategy for doing this looks to be different, and the SolidWorks API reference for these functions don't seem quite right (for example, UpdateModel() is a simplified version of UpdateTable() according to the documentation, yet they result in a different-looking model).
Here's a basic overview of our logic:
//Open Design Table
IModelDoc2 model = _swApp.ActivateDoc3(model.GetPathName(), false, (int)swRebuildOnActivation_e.swRebuildActiveDoc, ref errors);
model.Extension.SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, false, 0, null, 0);
IDesignTable swDesignTable = model.GetDesignTable();
dynamic worksheetTemp = swDesignTable.Worksheet;
var worksheet = (worksheetTemp as Excel.Worksheet);
//*Iterate through the worksheet, modifying required values using the Excel API*
//Close Design Table
This seems excessive but gives the closest results to a manual change, using only Attach()/Detach() or EditTable2()/UpdateModel() requires us to open and close the Design Table a second time for the changes to "take".
Does anyone have any ideas? Is there a definitive set of functions to call to properly update Design Tables? Any help is appreciated.