I couldn't find a macro to do this so I made one. Set your paths (see comments).
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim result As Long
Sub main()
Dim Path As String
' SET YOUR STL OUTPUT PATH
Path = "C:\Stuff\Files\3D printing\STL\"
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
If Part Is Nothing Then Exit Sub
If Part.GetType = swDocDRAWING Then
Exit Sub
End If
Dim Extension As String
Dim PartName As String
PartName = Part.GetTitle
If InStr(PartName, ".SLDPRT") = 0 Then
MsgBox "Save part first"
Exit Sub
End If
Call SelectAll(Part)
Extension = Mid(PartName, InStrRev(PartName, "."))
PartName = Replace(PartName, Extension, ".stl")
Path = Path & PartName
result = Part.SaveAs3(Path, 0, 0)
Call open_s3d(Chr(&H22) & Path & Chr(&H22))
End Sub
Sub open_s3d(stlPath As String)
Dim sFullPathToExecutable As String
sFullPathToExecutable = "C:\Program Files\Simplify3D\Simplify3D.exe" & Chr(&H20) & stlPath
Shell sFullPathToExecutable
End Sub
Sub SelectAll(swModel As SldWorks.ModelDoc2)
' Select all edges in the part,
swModel.Extension.SelectAll
End Sub
Message was edited by: Jason F.
SolidworksApi macros