Automatic Save As PDF

Discussion in 'SolidWorks' started by Richard Charney, Sep 17, 2007.

  1. 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
     
    Richard Charney, Sep 17, 2007
    #1
  2. Richard Charney

    mr.T Guest

    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
     
    mr.T, Sep 17, 2007
    #2
  3. Richard Charney

    dvanzile3 Guest

    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
     
    dvanzile3, Sep 17, 2007
    #3
  4. Richard Charney

    harry Guest

    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.
     
    harry, Sep 17, 2007
    #4
  5. Richard Charney

    jburtonSW Guest

    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
     
    jburtonSW, Sep 17, 2007
    #5
  6. Richard Charney

    fcsuper Guest

    Aside from not being automatic, please also check out the macro found
    here:
    http://sw.fcsuper.com/index.php?name=UpDownload&req=viewdownloaddetails&lid=3

    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
    http://sw.fcsuper.com
    http://tech.groups.yahoo.com/group/solidworks/
     
    fcsuper, Sep 18, 2007
    #6
  7. Richard Charney

    j Guest

    Check out PAK4SWX at http://swtools.cad.de/ This allows batch
    conversions but is not an automatic way. You still have to tell it to save.
     
    j, Sep 18, 2007
    #7
  8. Thanks everybody for their input!
    I'm sure I'll be able to get something working from all this input.

    Richard
     
    Richard Charney, Sep 18, 2007
    #8
  9. Hi, check out these free tools: www.markkulehtola.net -> SolidWorks ->
    SWxx-tools -> SWup and SWupSE

    Markku
     
    Markku Lehtola, Sep 18, 2007
    #9
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.