Hi !
I'm looking to save as all the files in a directory to a new directory and to keep the same file names and extensions. In my case, I have several .SLDLFP weldment profiles files created with a modified version of ConfigRipper. The problem is that the files are way too big (over 1MB each) because they had several configurations that were deleted. It seems that the only way to make the files smaller is to Save As them in a new directory and they become more than 10 times smaller afterwards. I've tried EcoSqueeze and Unfrag it help a little but not as much as "Save As".
I was looking for the Deepak Macro Batch File Open (modified to open SLDLFP files and hide the message box).
' Batch File Open and Save -------------------------------11/10/10
' Browse Folder codes: http://www.vbaexpress.com/kb/getarticle.php?kb_id=246
' Macro will find all the part files in the specified Path/location, rebuild & save drawing files.
' Currently the macro works for SW Drawings. Change the codes for parts or assemblies.
' Please backup your files and use at own risk.
' ------------------------------------------------------------------------------
' Written by: Deepak Gupta (http://gupta9665.wordpress.com/)
' ------------------------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc
Dim sFileName As String
Dim Path As String
Dim swLayerMgr As SldWorks.LayerMgr
Dim swLayer As SldWorks.Layer
Dim nErrors As Long
Dim nWarnings As Long
Sub main()
Set swApp = Application.SldWorks
Path = BrowseFolder("Select a Path/Folder")
Path = Path + "\"
' change slddrw to sldprt for parts and sldasm for assembly
sFileName = Dir(Path & "*.sldlfp") 'change to .sldasm for assembly and .sldprt for part files.
Do Until sFileName = ""
'MsgBox sFileName
' change swDocDRAWING to swDocPART for parts and swDocASSEMBLY for assembly
Set swModel = swApp.OpenDoc6(Path + sFileName, swDocPART, swOpenDocOptions_Silent, "", nErrors, nWarnings)
Set swModel = swApp.ActiveDoc
swModel.EditRebuild3
swModel.Save2 False
swApp.CloseDoc swModel.GetTitle
Set swModel = Nothing
sFileName = Dir
Loop
End Sub
What would be the command line for "Save As" rather than just rebuild and save ?
Also, I've selected swDocPART as file type and it seems to work. Is it the correct choice ?
Thanks !
SolidworksApi macros