MACRO LIBRARY

Lesson 4.2c code

Free public access. No account or subscription required.

Files

Lesson 4.2c code

Code

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Dim swSubFeat As SldWorks.Feature
    
Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swFeat = swModel.FirstFeature
    While Not swFeat Is Nothing
        Debug.Print "Name: " & swFeat.Name
        Debug.Print "   Type: " & swFeat.GetTypeName
        
        Set swSubFeat = swFeat.GetFirstSubFeature
        While Not swSubFeat Is Nothing
            Debug.Print "       Sub-feat name: " & swSubFeat.Name
            Debug.Print "           Sub-feat type: " & swSubFeat.GetTypeName2
            Set swSubFeat = swSubFeat.GetNextSubFeature
        Wend
        
        Set swFeat = swFeat.GetNextFeature
    Wend
End Sub