This is possible through a macro using pack and go.
- Define a IPackAndGo object (Set IPackAndGo = ModelDocExtension.GetPackAndGo)
- Use IPackAndGo::GetDocumentNames to get the names of documents (array)
- Modify the names of the documents (the array) and save it to the IPackAndGo object using IPackAndGo::SetSaveToName
- Use ModelDocExtension:SavePackandGo(IPackAndGo) to save
- Admire your work
Good to know that it is possible, but with my very limited knowledge of SW API and VBA, it's hard to write a workable code without an experienced help
I will dig thru the API help section and see if I can find something over there.
Alright, this seem to work on my end. Give it a try amigo. It will rename parts to part-1, part-2... and likewise for assemblies. It does not handle drawing though.
Dim swApp As SldWorks.SldWorks Dim swModel As ModelDoc2 Dim swModelDocExt As ModelDocExtension Dim SavingPath As String Sub main() SavingPath = InputBox("Where do you want to pack and go? Enter path here:", "PackAndGo by email@example.com") Dim FileSystemObject As Object Set FileSystemObject = CreateObject("Scripting.FileSystemObject") If Not FileSystemObject.FolderExists(SavingPath) Then MsgBox ("Folder does not exist.") End If Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swModelDocExt = swModel.Extension Dim PackAndGoObj As PackAndGo Set PackAndGoObj = swModelDocExt.GetPackAndGo Dim VDocs Dim result As Boolean PackAndGoObj.FlattenToSingleFolder = True PackAndGoObj.IncludeToolboxComponents = True result = PackAndGoObj.GetDocumentNames(VDocs) Dim Partcounter As Long: Partcounter = 1 Dim AssemblyCounter As Long: AssemblyCounter = 1 For i = 0 To UBound(VDocs) If Split(VDocs(i), ".")(1) = "sldprt" Then VDocs(i) = "Part-" & Partcounter & ".sldprt" Partcounter = Partcounter + 1 ElseIf Split(VDocs(i), ".")(1) = "sldasm" Then VDocs(i) = "Assem-" & AssemblyCounter & ".sldasm" AssemblyCounter = AssemblyCounter + 1 End If Next i result = PackAndGoObj.SetSaveToName(True, SavingPath) result = PackAndGoObj.SetDocumentSaveToNames(VDocs) Dim vResult vResult = swModelDocExt.SavePackAndGo(PackAndGoObj) End Sub