SolidWorks机械工程师网——最大的SolidWorks学习平台

标题: 遍历所有特征名和类型(书上学的) [打印本页]

作者: design100    时间: 2016-4-9 09:57
标题: 遍历所有特征名和类型(书上学的)
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeature As SldWorks.feature
Dim FeatName As String
Dim FeatType As String
Sub main()
    Set swApp = Application.SldWorks
    If Not swApp Is Nothing Then
        Set swModel = swApp.ActiveDoc
        If Not swModel Is Nothing Then
            Set swFeature = swModel.FirstFeature
            While Not swFeature Is Nothing
                FeatName = swFeature.Name
                FeatType = swFeature.GetTypeName
                MsgBox "Feature screen name = " & FeatName & vbCrLf & _
                        "Feature type name = " & FeatType
                Set swFeature = swFeature.GetNextFeature
            Wend
                End If
        Set swModel = Nothing
    End If
    Set swApp = Nothing
End Sub

作者: Ihr_Mann    时间: 2016-4-13 22:31
感谢楼主分享,很不错!
作者: dy380v    时间: 2016-4-14 23:57
楼主太有才了,膜拜中……
作者: xiaoxifeng14    时间: 2016-9-15 13:46
请问楼主,能不能把你的程序改下变成中英文转化呢啊
作者: 祥子1991    时间: 2017-2-7 20:42
看看,学习一下

作者: 三国神杀手2    时间: 2017-3-2 18:30
楼主辛苦了!
作者: 可乐瓶子    时间: 2021-10-14 12:21
楼主辛苦了!




欢迎光临 SolidWorks机械工程师网——最大的SolidWorks学习平台 (https://www.swbbsc.com/) Powered by Discuz! X3.2