Get Feature in Reverse Order Example (VBA)
This example shows how to get the names of the features in the FeatureManager
tree in reverse chronological order.
'----------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swFeat As
SldWorks.feature
Dim
i As
Long
Dim
bRet As
Boolean
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Debug.Print
"File = " & swModel.GetPathName
For
i = 0 To swModel.GetFeatureCount
- 1
Set
swFeat = swModel.FeatureByPositionReverse(i)
Debug.Print
" "
& swFeat.Name & " [" & swFeat.GetTypeName
& "]"
Next
i
End Sub
'----------------------------------