Hi,
I have the following scipt which is working great. However I want the outcome ( a part file and a step file) to end up in the L:\\Temp folder, always. How do I hard code that in?
This is script right now:
| Dim swApp | As SldWorks.SldWorks | |
| Dim swModel | As SldWorks.ModelDoc2 | |
| Dim swModelDocExt | As SldWorks.ModelDocExtension | |
| Dim FilePath | As String | |
| Dim sFilePath | As String | |
| Dim PathSize | As Long | |
| Dim PathNoExtension | As String | |
| Dim NewFilePath | As String | |
| Dim nErrors | As Long | |
| Dim nWarnings | As Long |
Sub main()
Set swApp = Application.SldWorks
'Set swModel = swApp.ActiveDoc
Set swModel = swApp.OpenDoc6("
Set swModelDocExt = swModel.Extension
FilePath = swModel.GetPathName
PathSize = Strings.Len(FilePath)
PathNoExtension = Strings.Left(FilePath, PathSize - 6)
NewFilePath = PathNoExtension & "SLDPRT"
swApp.SetUserPreferenceIntegerValue swSaveAssemblyAsPartOptions, swSaveAsmAsPart_ExteriorFaces
swModelDocExt.SaveAs NewFilePath, swSaveAsCurrentVersion, swSaveAsOptions_Silent, Nothing, nErrors, nWarnings
'swApp.CloseDoc swModel.GetTitle
Set swModel = swApp.OpenDoc6(NewFilePath, SwConst.swDocPART, 3, "", nErrors, nWarnings)
Set swModel = swApp.ActiveDoc
sFilePath = PathNoExtension & "STEP"
swModel.SaveAs (sFilePath)
swApp.CloseDoc swModel.GetTitle
End Sub
SolidworksSolidworks Pdm enterprise Pdm