这个宏遍历featuremanager,solidworks需要先打开一个有feature树的文件:

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
Set swModel = swApp.ActiveDoc

      Set swFeature = swModel.FirstFeature
      Do While Not swFeature Is Nothing
        FeatName = swFeature.Name
        FeatType = swFeature.GetTypeName2()
        
        Debug.Print "Feature screen name = " & FeatName
        Debug.Print "Feature type name = " & FeatType
        Debug.Print ""
        
        Set swFeature = swFeature.GetNextFeature
      Loop

Set swModel = Nothing
Set swApp = Nothing
End Sub

solidworks先打开一个有切割清单的文件,然后执行此宏,此宏会列出切割清单的属性:

Option Explicit

Dim swApp As SldWorks.SldWorks

Sub main()
    
    Set swApp = Application.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Set swModel = swApp.ActiveDoc
    
    Dim swCutListPrpMgr As SldWorks.CustomPropertyManager
    Set swCutListPrpMgr = GetCutListPropertyManager(swModel)
    
    If Not swCutListPrpMgr Is Nothing Then
        ListProperties swCutListPrpMgr
    Else
        Debug.Print "Cut-list is not found"
    End If

End Sub

Function GetCutListPropertyManager(model As SldWorks.ModelDoc2) As SldWorks.CustomPropertyManager
    Dim swFeat As SldWorks.Feature
    Set swFeat = model.FirstFeature
    
    Do While Not swFeat Is Nothing
        
        If swFeat.GetTypeName2() = "CutListFolder" Then
            Set GetCutListPropertyManager = swFeat.CustomPropertyManager
            Exit Function
        End If

        Set swFeat = swFeat.GetNextFeature
    Loop
    
End Function

Sub ListProperties(srcPrpMgr As SldWorks.CustomPropertyManager)
    Dim vPrpNames() As String
    vPrpNames = srcPrpMgr.GetNames()
    
    Dim i As Integer
    Dim prpName As String

    For i = 0 To UBound(vPrpNames)
        prpName = vPrpNames(i)
        Dim prpVal As String
        Dim prpResVal As String
                    
        srcPrpMgr.Get5 prpName, False, prpVal, prpResVal, False
        
        Debug.Print "prpName: " & prpName
        Debug.Print "prpVal: " & prpVal
        Debug.Print "prpResVal: " & prpResVal
    Next
End Sub