Selecting Sub-Features using API

Good Wednesday to you all!

So I've got a macro that makes a flat pattern by stepping through the feature tree and unsupressing everything. I just found a crucial flaw, though. It only unsuppresses features. Meaning that if in the flat pattern feature, if a bend is suppressed, it won't catch it. I was wondering if anyone had any idea how I can access the sub-features?

I've included my code, I realize its a little convoluted and redundant, but it seems to work really well excluding this problem.

Thanks in advance for anything you can give me,


Trevor

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim swModel As ModelDoc2

Dim boolStatus As Boolean
Dim feat As Object
Dim featureName As String
Const SWDOCPART = 1
Const SWDOCASSEMBLY = 2
Const SWDOCDRAWING = 3
Dim vConfigName As Variant
Dim sConfigName As String
Dim i As Long
Dim swConfig As SldWorks.Configuration


Sub main()

    Set swApp = Application.SldWorks

    Set swModel = swApp.ActiveDoc

    Dim configMgr As ConfigurationManager

    Dim C1a As Configuration

    Dim selMgr As SelectionMgr

    Dim res As Variant
   

    Set selMgr = swModel.SelectionManager

    Set configMgr = swModel.ConfigurationManager
   
    swModel.ShowConfiguration2 ("Default")
   
'New code to find configuration names
    Set swConfig = swModel.GetActiveConfiguration
    vConfigName = swModel.GetConfigurationNames
   
    For i = 0 To UBound(vConfigName)
   
        sConfigName = vConfigName(i)
         
        Set swConfig = swModel.GetConfigurationByName(sConfigName)
            
        If sConfigName = "Default" Then
       
       
        ElseIf sConfigName = "DefaultSM-FLAT-PATTERN" Then
           
            'make flat pattern active configuration
            swModel.ShowConfiguration2 ("DefaultSM-FLAT-PATTERN")
       
            If (swModel.GetType <> SWDOCPART) Then
                End
            End If
   
            Set feat = swModel.FirstFeature
   
            Do While Not feat Is Nothing
   
            Let featureName = feat.Name
   
            res = swModel.SelectByID(featureName, "BODYFEATURE", 0, 0, 0)
            res = swModel.EditUnsuppress()
   
            Set feat = feat.GetNextFeature()
            Loop
       
            'set back to the correct configuration
            swModel.ShowConfiguration2 ("Default")
        End
       
        End If

      
    Next
'End new code
   
    'create flat pattern configuration
   
    configMgr.AddConfiguration "DefaultSM-FLAT-PATTERN", "DefaultSM-FLAT-PATTERN", "Alternate Name", 1, "Default", "no description"

   
    If (swModel.GetType <> SWDOCPART) Then
    End
    End If
   
    Set feat = swModel.FirstFeature
   
    Do While Not feat Is Nothing
   
    Let featureName = feat.Name
   
    res = swModel.SelectByID(featureName, "BODYFEATURE", 0, 0, 0)
    res = swModel.EditUnsuppress()
   
    Set feat = feat.GetNextFeature()
    Loop
       
    'set back to the correct configuration
    swModel.ShowConfiguration2 ("Default")
   
   
   
End Sub

SolidworksApi macros