2 Replies Latest reply on Apr 10, 2014 4:44 PM by Terry Raymond

    Delete empty cutlist folders

    Terry Raymond

      In SW 2013, some of our models have hidden cutlist folders, with no bodies.


      I'd like to delete them with my macro but can't figure out how.  Any ideas?



      Example file with hidden cutlist folders attached.  It has 3 visible folders, and 3 invisible.  Some code that shows the 6 cutlist items:

      Dim g_swApp As SldWorks.SldWorks

      Dim g_swDoc As SldWorks.ModelDoc2


      Sub main()

          Set g_swApp = Application.SldWorks

          Set g_swDoc = g_swApp.ActiveDoc


          Dim swFeature As SldWorks.Feature

          Set swFeature = g_swDoc.FirstFeature

          Do While Not swFeature Is Nothing

              Debug.Print "  " & swFeature.Name & " [" & swFeature.GetTypeName & "]"

              Set swFeature = swFeature.GetNextFeature


      End Sub



      I've tried below, but it doesn't delete folder:

      If swFeature.GetTypeName = "CutListFolder" Then

           If IsEmpty(swFeature.GetSpecificFeature2.GetBodies) Then

                swFeature.ModifyDefinition(swFeature.GetDefinition, g_swDoc, Nothing)

           End If

      End If


      Thanks for any help!