Automatic Save As PDF

Does anybody know of an automatic way of saving as a PDF, like when you
finish working on a drawing and along with saving the drawing it also does a
save as PDF to a pre-determined directory?
Is there a macro out there that will do this?
A seperate program to do this?
And yes, I would be willing to pay for a program that does this.
Thanks,
Richard
Reply to
Richard Charney
Loading thread data ...
I have macro button that when clicked saves pdf copy to the proper dir depending on file name
I use it instead print button and I do hard copy from acrobat
working on a drawing and along with
Reply to
mr.T
Solidworks doesn't do this directly but to be honest, it should incorporate this as an option for drawings. What you could do however is create a macro and assign this to a button that runs the macro. You could use this button as your new "save" button. You could even assign it the save picture so it looks like the original if you wanted to.
What I use is a batch program that just takes a bunch of drawings and converts them to pdf's in their working directory. This of course is a second process but it's what I'm used to doing.
I've clipped some of the macro and altered it a little to do what you want. I'm sure this can be cleaned up, but for now this works. Just create an empty macro and paste this.
Sub main()
Dim swapp As Object Dim part As Object Dim FileName As String Dim NewFileName As String Dim FilePath As String Dim FileCount As String Dim fileOpenErrors As Long Dim PartNo As String Dim Name As String Dim num1 As Integer Dim num2 As Integer Dim Counter As Integer Dim TypeFile As Long Dim TypeFileSave As String Dim str1 As String Dim SaveRetval As Long Dim DirRetval As Boolean Dim CurrDirFilePath As String Dim tempstr As String Dim tempstr2 As String
Set swapp = Application.SldWorks Set part = swapp.ActiveDoc
FilePath = part.GetPathName FileName = part.GetTitle
num1 = InStr(FileName, ".SLDPRT") num2 = InStr(FileName, ".sldprt") If num1 Or num2 Then TypeFile = 1 TypeFileSave = ".SLDPRT" End If
num1 = InStr(FileName, ".SLDASM") num2 = InStr(FileName, ".sldasm") If num1 Or num2 Then TypeFile = 2 TypeFileSave = ".SLDASM" End If
num1 = InStr(FileName, ".SLDDRW") num2 = InStr(FileName, ".slddrw") If num1 Or num2 Then TypeFile = 3 TypeFileSave = ".SLDDRW" End If
'Set working Directory For num2 = Len(FilePath) To 1 Step -1 If Mid(FilePath, num2, 1) = "\" Then CurrDirFilePath = Left(FilePath, num2 - 1) num2 = 1 End If Next num2
DirRetval = swapp.SetCurrentWorkingDirectory(CurrDirFilePath)
Let tempstr = FileName If UCase(Right(tempstr, 7)) = ".SLDDRW" Then tempstr = Left(tempstr, Len(tempstr) - 7) NewFileName = tempstr SaveRetval = part.SaveAs2(NewFileName & ".pdf", 0, True, False)
If SaveRetval 0 Then MsgBox "There was an error saving " & FileName & " to " & ".pdf" & " possibly because of READ ONLY or ILLEGAL character such as the @ symbol or just left blank" End If
retval = part.Save2(0) swapp.CloseDoc (FileName)
End
Reply to
dvanzile3
Richard:
DBWorks PDM/PLM will do this automatically for you...keeping the drawing and PDF associated to each other.. plus every time you revise the drawing it automatically update the pdf.
Reply to
harry
PDMWorks 2008 will do this if you choose. (you can download now from the web) No need for a macro... not sure if you have SolidWorks Office Pro, if you do, you will already have PDMWorks.
Cheers, Justin
Reply to
jburtonSW
Aside from not being automatic, please also check out the macro found here:
formatting link
It provides three methods for determining save location (the default is the one you asked for). Methods used in this macro can be used to make other macros as well.
Matt Lorono
formatting link
Reply to
fcsuper
Check out PAK4SWX at
formatting link
This allows batch conversions but is not an automatic way. You still have to tell it to save.
Reply to
j
Thanks everybody for their input! I'm sure I'll be able to get something working from all this input.
Richard
> Richard Charney wrote: >> Does anybody know of an automatic way of saving as a PDF, like when you >> finish working on a drawing and along with saving the drawing it also >> does a save as PDF to a pre-determined directory? >> >> Is there a macro out there that will do this? >> >> A seperate program to do this? >> And yes, I would be willing to pay for a program that does this. >> >> Thanks, >> Richard > Check out PAK4SWX at
formatting link
This allows batch conversions > but is not an automatic way. You still have to tell it to save. > >
Reply to
Richard Charney

Site Timeline

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.