Solidworks 与Excel C# 引用系列零件设计表
打开时我无法修改设计表,我遇到的问题是 varsheet = (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]
}
I can't get my design table to modify when opened the line I am having the trouble is var sheet = (Excel._Worksheet)swDoc.GetDesignTable; . Essentially what I want it to do is open the window and reference the active sheet which is the "Design Table". The API does include "DesignTable" as type. I have been stuck for a while. Any help is appreciated.
//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]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了
Figured it out