+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Send to PDF

  1. #1
    Full Member
    Discipline
    Mechanical
    Using
    AutoCAD 2015
    Join Date
    Nov 2017
    Posts
    93

    Default Send to PDF

    Registered forum members do not see this ad.

    I have written a send a .dwg to .pdf routine and it is not working.

    Here are the plot settings.



    Any ideas?

    Code:
    (defun c:SendToPDF ( / *error* vars old s file Fname fsl dwgN)
    
       (defun *error* ( msg )
          (and old (mapcar 'setvar vars old))
          (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
          (princ (strcat "\n** Error: " msg " **")))
          (princ)
       )
    
       (setq vars '("CMDECHO" "FILEDIA") old (mapcar 'getvar vars))
       (mapcar 'setvar vars '(0 0))
       (setq dwgN (getvar "dwgname"))
       (setq fsl (strlen dwgn))
       (Setq Fsl (- fsl 4))
       (setq Fname (substr dwgn 1 fsl))
       (setq Fname (strcase fname t))
       (setq file (strcat (getvar 'DWGPREFIX) (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) ".pdf"))
    
       (while
          (progn
             (setq s (getstring (strcat "\nEnter Filename for Save <" (getvar 'file) "> : ")))
             
             (cond ( (eq "" s)
             (setq s (getvar 'DWGNAME)) nil)
             
             ( (not (snvalid s))
             (princ "\n** Invalid **")))
          )
       )
    (setq path (getvar "dwgprefix"))
    
    
    ; (command "_.saveas" "_2010" (strcat "G:\\Group\\2D AutoCAD\\HDAL Library\\" s))
    ;(command "_.saveas" "_2007" (strcat path s))
      (command "-plot"         "yes"           ""              "DWG TO PDF.PC3"
               "ANSI expand B (11.00 x 17.00 Inches)" "Inches"        "Landscape"     "yes"           "Extents"
               "yes"           "yes"               "yes"           "monochrome.ctb"       "yes"
               "no"            "no"            "yes"           file            "no"            "Yes"
              )
    (mapcar 'setvar vars old)
    
    (princ)
    )
    Greg
    Attached Images

  2. #2
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    943

    Default

    I'm not sure because I haven't tested your routine but does it maybe fail on the paper size? You don't mention... I ask because I had this problem once and after I replaced the spaces in my paper size with underscores it worked...

  3. #3
    Full Member
    Discipline
    Mechanical
    Using
    AutoCAD 2015
    Join Date
    Nov 2017
    Posts
    93

    Default

    Quote Originally Posted by rlx View Post
    I'm not sure because I haven't tested your routine but does it maybe fail on the paper size? You don't mention... I ask because I had this problem once and after I replaced the spaces in my paper size with underscores it worked...
    Thanks. I will give that a shot and see what happens.

    Greg

  4. #4
    Senior Member
    Discipline
    Manufacture
    BrianTFC's Discipline Details
    Occupation
    Structral Detailer
    Discipline
    Manufacture
    Using
    AutoCAD 2017
    Join Date
    Jan 2012
    Location
    Indiana
    Posts
    183

    Default

    GregGleason,

    try this.


    Code:
    (defun c:Test()
          (vl-load-com)
        
          (if (setq filename (getfiled "Save File Location" ""  "pdf" 1))
      (progn 
          (command "-plot" "yes" "" "DWG To PDF.pc3" "ANSI expand B (11.00 x 17.00 Inches)"
              "inches" "landscape" "yes" "Extents"
              "fit" "center" "yes" "monochrome.ctb" "yes" "a" filename "no" "yes")
                    )
              )
          )

  5. #5
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    943

    Default

    Probably Brian's suggestion will work so just show where you went wrong:

    to make the file name try his :
    Code:
     (setq file (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf"))
    also :
    Code:
     (setq s (getstring (strcat "\nEnter Filename for Save <" (getvar 'file) "> : ")))
    file is not a system variable so it should be :
    Code:
     (setq s (getstring (strcat "\nEnter Filename for Save <" file "> : ")))
    hope this helps

    gr. Rlx

  6. #6
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,421

    Default

    2c - I'd store the file lisp variable like this:
    Code:
    (setq file (apply '(lambda (a b c) (strcat a b ".pdf")) (fnsplitl (apply 'strcat (mapcar 'getvar '(dwgprefix dwgname))))))

  7. #7
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    943

    Default

    Quote Originally Posted by Grrr View Post
    2c - I'd store the file lisp variable like this:
    Code:
    (setq file (apply '(lambda (a b c) (strcat a b ".pdf")) (fnsplitl (apply 'strcat (mapcar 'getvar '(dwgprefix dwgname))))))
    make it 20 dollar cause never seen this construct haha

  8. #8
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,421

    Default

    Quote Originally Posted by rlx View Post
    make it 20 dollar cause never seen this construct haha
    Haha.. cheers!

  9. #9
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,400

    Default

    There is a lot more you can do like plot a range of layouts to pdf's, make a single pdf of a range etc. You will need to down load and install ghostscript seperately for the combine routine.
    Attached Files
    A man who never made mistakes never made anything

  10. #10
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    943

    Default

    Registered forum members do not see this ad.

    AH! now the biting makes sense! fnsplitl is a real function....
    Attached Images

Similar Threads

  1. Trying send image
    By Luancat in forum Feedback
    Replies: 1
    Last Post: 12th Dec 2015, 01:34 pm
  2. not to send macros with dwg
    By dusko in forum AutoCAD General
    Replies: 1
    Last Post: 26th Oct 2009, 05:14 pm
  3. Add Arc using send command
    By lewis770227 in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 20th Jan 2009, 02:56 pm
  4. Little help with send command
    By Barry Clark in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 26th Feb 2006, 03:00 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts