How to write properties in the cut list of multibody-part

Hello everyone,

i use a multibody-part with SW2017 sp5, I have this macro that works perfectly to write some properties in the cut list:

the macro recognizes that the body was made with "metal-sheet function" and writes properties in the cut-list only in "metal-sheet" bodies.

I would have this further improvement,:

when it recognizes the first sheet-metal body I want to define a progressive number "1" and use it in the properties of the cutting list of this body

when it recognizes the second sheet-metal body I want to define a progressive number "2" and use it in the properties of the cutting list of this body

when it recognizes the third sheet-metal body I want to define a progressive number "3" and use it in the properties of the cutting list of this body

can you help me????????

look below my macro

Thanks in advance

Option Explicit

    Dim swApp               As SldWorks.SldWorks

    Dim vBodies             As Variant

    Dim swmodel             As SldWorks.ModelDoc2

    Dim swFeat              As SldWorks.Feature

    Dim swCustPropMgr       As SldWorks.CustomPropertyManager

    Dim FileNumber          As String

    Dim FileName            As String

    Dim Codice_1            As String

    Dim CODICE              As String

    Dim CODICE_FINALE       As String

    Dim UM                  As String

    Dim PESO                As String

    Dim DESCRIZIONE         As String

    Dim TIPO_LAM_1          As String

    Dim TIPO_LAM_2          As String

    Dim sThickness          As String

    Dim Folds               As String

    Dim swBodyFolder        As SldWorks.BodyFolder

    Dim j                   As Integer

    Dim swBody              As Body2

  

  

Sub main()

    On Error Resume Next

    Set swApp = Application.SldWorks

    Set swmodel = swApp.ActiveDoc

    Set swCustPropMgr = swmodel.Extension.CustomPropertyManager("")

    swCustPropMgr.Get4 "CODICE", False, CODICE, """"

    swCustPropMgr.Get4 "CODICE_FINALE", False, CODICE_FINALE, """"

    swCustPropMgr.Get4 "UM", False, UM, ""

    swCustPropMgr.Get4 "PESO", False, PESO, ""

    swCustPropMgr.Get4 "DESCRIZIONE", False, DESCRIZIONE, """"

    swCustPropMgr.Get4 "TIPO_LAM_1", False, TIPO_LAM_1, """"

    swCustPropMgr.Get4 "TIPO_LAM_2", False, TIPO_LAM_2, """"

   'search the file name

    FileName = swmodel.GetTitle

    Debug.Print "Nome File --> "; FileName

  

    'delete the file extension

    Codice_1 = Left(FileName, InStrRev(swmodel.GetTitle, ".") - 1)

    Debug.Print "Codice_1 --> "; Codice_1

  

    Set swFeat = swmodel.FirstFeature

        Do While Not swFeat Is Nothing

        Debug.Print "NAME: " & swFeat.Name & "   - TYPE: " & swFeat.GetTypeName

      

        swFeat.GetSpecificFeature2

      

            If swFeat.GetTypeName() = "CutListFolder" Then

            Set swBodyFolder = swFeat.GetSpecificFeature2

          

        'Debug.Print swFeat.GetTypeName

          

            vBodies = swBodyFolder.GetBodies

             For j = 0 To UBound(vBodies)

            

                Set swBody = vBodies(j)

               'if he finds a sheet-metal he writes "SHEET METAL !!!! -> N." & progressive number

                If swBody.IsSheetMetal Then Debug.Print "SHEET METAL!!!! --> N." progressive number

                If swBody.IsSheetMetal = False Then GoTo salta

             Next j

              

          

           ' here the macro write the properties in the cut-list

            swBodyFolder.UpdateCutList

            

                        Set swCustPropMgr = swFeat.CustomPropertyManager

                        swCustPropMgr.Get4 "Spessore lamiera", False, "", sThickness

                      

                        swCustPropMgr.Add3 "CODICE", swCustomInfoText, Codice_1 & "." & progressive number, 1

                        swCustPropMgr.Add3 "CODICE_FINALE", swCustomInfoText, Codice_1 & "." & progressive number, 1

                        swCustPropMgr.Add3 "UM", swCustomInfoText, "NR", 1

                        swCustPropMgr.Add3 "PESO", swCustomInfoText, Chr(34) & "SW-MASS" & Chr(34), 1

                        swCustPropMgr.Add3 "DESCRIZIONE", swCustomInfoText, "Lamiera sp. " & sThickness & "mm", 1

                        swCustPropMgr.Add3 "TIPO_LAM_2", swCustomInfoText, "sp. " & sThickness & "mm", 1

                      

                        swCustPropMgr.Get4 "Piegature", False, "", Folds

                      

                        If Folds = 0 Then

                        swCustPropMgr.Add3 "TIPO_LAM_1", swCustomInfoText, "PIANA", 1

                            Else

                            swCustPropMgr.Add3 "TIPO_LAM_1", swCustomInfoText, "PIEGATA", 1

                        End If

                      

            End If

          

salta:

      

        Set swFeat = swFeat.GetNextFeature

        Loop

End Sub

SolidworksApi/macros