在这个基础上,完成下文。
代码可能比较乱,没有整理。
1)添加摘要
2)编写读取按键的代码
private void SW_Read(object sender, RoutedEventArgs e)
{
sld4Handler.ModelDoc = sld4Handler.SwApp.ActiveDoc;
string author = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoAuthor];
string comment = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoComment];
string createDate = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoCreateDate];
string createDate2 = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoCreateDate2];
string keywords = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoKeywords];
string saveDate = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoSaveDate];
string saveDate2 = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoSaveDate2];
string savedBy = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoSavedBy];
string subject = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoSubject];
string title = sld4Handler.ModelDoc.SummaryInfo[(int)swSummInfoField_e.swSumInfoTitle];
MessageBox.Show("author:"+ author+"\n"+ "comment:" + comment + "\n"+ "createDate:" + createDate + "\n"+
"createDate2:" + createDate2 + "\n"+ "keywords:" + keywords + "\n"+ "saveDate:" + saveDate + "\n"+
"saveDate2:" + saveDate2 + "\n"+ "savedBy:" + savedBy + "\n"+ "subject:" + subject + "\n" + "title:" + title + "\n");
}
3)测试
首先要打开Solidworks,打开零件,完成摘要。
开始VS调试
首先要链接Solidworks
然后点击读取。