I have found a macro for solidworks that works for an individual part, but I will have to (an the rest of the office) will have to change the name taken by the cut list bodies each time.
is there a way to take the file name from the part (we work in multibody parts) and apply it to the cutlist bodies +1 fo each consecutive body?
As mentioned before this macro renames the bodies, it would be absolutely stellar if it took the name from the part file name as this is in accordance with our standard.
code:
Dim swApp As Object
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swPart As SldWorks.PartDoc
Dim vBodyArr As Variant
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swPart = swModel
swModel.ClearSelection2 True
vBodyArr = swPart.GetBodies2(0, False)
RenameBodies swModel, vBodyArr
End Sub
Sub RenameBodies(swModel As SldWorks.ModelDoc2, vBodyArr As Variant)
Dim vBody As Variant
Dim swBody As SldWorks.Body2
Dim prefixName As String
Dim bodycount As Integer
bodycount = 1
If IsEmpty(vBodyArr) Then Exit Sub
prefixName = "Set swCustPropMgr = TheModel.Extension.CustomPropertyManager"
For Each vBody In vBodyArr
vBody.Name = prefixName & bodycount
bodycount = bodycount + 1
Next vBody
swModel.EditRebuild3
End Sub