2 Replies Latest reply on Jul 1, 2018 6:46 AM by Voverrr Mironoff

    How to check folder in cut list on included/excluded?

    Voverrr Mironoff

      Hello.

      I have the multibody part and want to get the number of folders(thanks to Keith), I got it, and then I try to check each folder on including/excluding in  the cut list.

      I modified Keith's code:

       

      Dim swApp As SldWorks.SldWorks

      Dim swModel As SldWorks.ModelDoc2

      Dim swFeat As SldWorks.Feature

      Dim Foldercount As Integer

      Dim EXCL as integer

        

      Sub main()

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swFeat = swModel.FirstFeature

          Foldercount = 0 'number of all folders

          EXCL = 0 'number of excluded folders

       

          While Not swFeat Is Nothing

              If swFeat.GetTypeName = "CutListFolder" Then

                  Debug.Print swFeat.Name

                  If swFeat.ExcludeFromCutList = True Then                    'here I want to check the folder

                  EXCL = EXCL + 1                'count of folders excluded from the cut list

                  Debug.Print EXCL

                  End If

                  Foldercount = Foldercount + 1

              End If

              Set swFeat = swFeat.GetNextFeature

          Wend

          swApp.SendMsgToUser intCount & " folders in the solid bodies folder."

      End Sub

       

      Thank you.

        • Re: How to check folder in cut list on included/excluded?
          Fifi Riri

          Hello

           

          Dim swApp As SldWorks.SldWorks

          Dim swModel As SldWorks.ModelDoc2

          Dim swFeat As SldWorks.Feature

          Dim Foldercount As Integer

          Dim EXCL As Integer

           

          Sub main()

              Set swApp = Application.SldWorks

              Set swModel = swApp.ActiveDoc

              Set swFeat = swModel.FirstFeature

              Foldercount = 0 'number of all folders

              EXCL = 0 'number of excluded folders

           

              While Not swFeat Is Nothing

                  If swFeat.GetTypeName = "CutListFolder" Then

                      Debug.Print swFeat.Name

                      If swFeat.ExcludeFromCutList Then

                          EXCL = EXCL + 1

                          Debug.Print EXCL

                      End If

                      Foldercount = Foldercount + 1

                  End If

                  Set swFeat = swFeat.GetNextFeature

              Wend

           

              swApp.SendMsgToUser EXCL & " folders excluded from the cut list out of " & Foldercount & " folders."

          End Sub