Rename bodies in cut list

I have a macro that goes through the cut list and saves each body as a new part.  I am trying to figure out a way to rename the solid body in the cutlist to the name i used for the new parts.


Here is my code:

Dim swApp As Object

Dim Part As Object

Dim Part1 As SldWorks.PartDoc

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

Dim bret As Boolean

Dim i As String

Dim fname As String

Sub main()

 

Response = MsgBox("You must rename the 'Structural Member' feature to 'Flume' for this macro to work correctly.  Continue?", vbYesNo, "Feature Name Check")

If Response = vbYes Then    ' User chose Yes.

    GoTo Start

Else    ' User chose No.

    End

End If

Start:

Set swApp = Application.SldWorks

 

Set Part = swApp.ActiveDoc

i = 1

 

boolstatus = True

While boolstatus = True

    boolstatus = Part.Extension.SelectByID2("Flume[" + i + "]", "SOLIDBODY", 0, 0, 0, False, 0, Nothing, 0)

 

    Set Part = swApp.ActiveDoc

    Set Part1 = Part

    Dim myModelView As Object

    Set myModelView = Part.ActiveView

    myModelView.FrameLeft = 0

    myModelView.FrameTop = 21

    Set myModelView = Part.ActiveView

    myModelView.FrameState = swWindowState_e.swWindowMaximized

    fname = i + ".sldprt"

    bret = Part1.SaveToFile2(fname, 1, 1, 0)

    swApp.CloseDoc fname

    i = i + 1

    boolstatus = Part.Extension.SelectByID2("Flume[" + i + "]", "SOLIDBODY", 0, 0, 0, False, 0, Nothing, 0)

Wend

End Sub

SolidworksApi macros