打开我遇到问题的行时我无法修改设计表是 var sheet = (Excel._Worksheet)swDoc.GetDesignTable; . 基本上我想要它做的是打开窗口并引用活动表,即“设计表”。API 确实包含“DesignTable”作为类型。我被困了一段时间。任何帮助表示赞赏。
//Open Solidworks Design Table
SldWorks swApp;
swApp = null;
swApp = (SldWorks)Activator.CreateInstance(Type.GetTypeFromProgID("SldWorks.Application"));
ModelDoc2 swDoc = null;
bool boolstatus = false;
swDoc = ((ModelDoc2)(swApp.ActiveDoc));
boolstatus = swDoc.Extension.SelectByID2("Design Table", "DESIGNTABLE", 0, 0, 0, false, 0, null, 0);
swDoc.InsertFamilyTableEdit();
var sheet = (Excel._Worksheet)swDoc.GetDesignTable;
//Generate Linear Guide Support in Solidworks
if (comboBox1.Text == "0")//No External Rails
{
sheet.Cells[6, 4] = "0"; //Cell Location [y-axis, x-axis]
}