Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Option Explicit

Dim swApp As SldWorks.SldWorks


Dim swPartDoc As SldWorks.ModelDoc2
Dim swFeature As SldWorks.feature
Dim swSubFeature As SldWorks.feature
Dim featureName As String
Dim subFeatureName As String
Dim message As String
Sub main()
Set swApp = Application.SldWorks
Set swPartDoc = swApp.ActiveDoc
' Get the first feature in part
Set swFeature = swPartDoc.FirstFeature
' While we have a valid feature
While Not swFeature Is Nothing
' Get the name of the feature
featureName = swFeature.Name
message = "Feature: " & featureName & Chr(10) & " SubFeatures:"
Set swSubFeature = swFeature.GetFirstSubFeature
' While we have a valid sub-feature
While Not swSubFeature Is Nothing
' Get the name of the sub-feature
subFeatureName = swSubFeature.Name
message = message & Chr(10) & " " & subFeatureName
Set swSubFeature = swSubFeature.GetNextSubFeature
' Continue until the last sub-feature is found
Wend
' Display the sub-features
swApp.SendMsgToUser message
' Get the next feature
Set swFeature = swFeature.GetNextFeature()
' Continue until the last feature is found
Wend
End Sub

You might also like