读取Solidworks文件的摘要

这篇博客介绍了如何在Solidworks中获取模型的摘要信息,并通过Visual Studio进行调试。作者展示了读取摘要字段如作者、创建日期、关键词等的代码,并提供了测试步骤,包括连接Solidworks、打开零件及展示摘要信息。
摘要由CSDN通过智能技术生成

Solidworks学习笔记-链接Solidworks

在这个基础上,完成下文。

代码可能比较乱,没有整理。

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

 然后点击读取。

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值