How do I create a design table in a part or assembly document via SolidWorks API?
I tried to find anything in the API docs, but IDesignTable interface lists only IModelDoc2.GetDesignTable as an accessor.
Typing "design table" in the index also gives no useful results: The only useful I find is the topic "insert", which links me to either IModelDoc2.InsertFamilyTableNew which has to do with drawings and IModelDoc2.InsertFamilyTableOpen which requires an excel file.
I just want to create a new design table, analog to this option in the GUI
but without any user interference and without the user noticing anything.
create design table in part or assembly
Re: create design table in part or assembly
Just a quick macro to test this adds a design blank table to a part and then closes it, because it pop up an Excel window.
I imagine you'll have to edit the design table feature after the fact with IDesignTable::EditFeature to modify the settings that pop up when a user adds a table with the UI.
Code: Select all
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
swModel.InsertFamilyTableNew
swModel.CloseFamilyTable
End Sub