I am wondering if it is possible to make an API macro so when the Save As dialog box comes up I can have a macro that runs in the backround that will set the folder location to one designated by the API macro.
SolidworksApi macros
I am wondering if it is possible to make an API macro so when the Save As dialog box comes up I can have a macro that runs in the backround that will set the folder location to one designated by the API macro.
SolidworksApi macros
You can use the macro while doing save as that can set the folder. I mean that use a macro to do the save as instead of using the normal save as button
Saves dxfs of a parts selected face. But you can change it to do save as to a macro designated folder.
This is essentially what i have
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.modelDoc2
Dim boolstat As Boolean
Dim Errors As Long
Dim Warnings As Long
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
boolstat = swModel.Extension.RunCommand(swCommands_SaveAs, "Hi")
End Sub
is there a way for me to set what the default folder is using the macro.
I tried this.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim boolstat As Boolean
Dim Errors As Long
Dim Warnings As Long
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
swApp.SetCurrentWorkingDirectory ("C:\Users\JOSE\Documents\01_SolidWorks\")
swModel.Extension.RunCommand swCommands_Open, "" 'swCommands_Saveto_Separate_File 'swCommands_SaveAs
'boolstat = swModel.Extension.RunCommand(swCommands_SaveAs, "")
End Sub
For swCommands_SaveAs it does not work like Open.
This seems to be working well for a fresh save but if i am doing a save as on a part in an assembly and i get the "This file is being referenced by other open documents" it seems to reset the directory to where the file is located.
is there a way around this
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.modelDoc2
Dim boolstat As Boolean
Dim Errors As Long
Dim Warnings As Long
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
swApp.SetCurrentWorkingDirectory ("C:\Users\pickensj\Documents")
boolstat = swModel.Extension.RunCommand(swCommands_SaveAs, Empty)
End Sub
I've dealt with save as macro functions for a few projects and it always turns out that I need an advanced macro to perform what I need like the first macro I attached. This might be the case for what you are trying to do.
I think your right I going to have to make my own button with a macro attached to preform a save. I am trying make the file location offered as the location were the file should be save to avoid constantly going through directorys and folders to save.