GregGleason Posted April 9, 2018 Share Posted April 9, 2018 I have written a send a .dwg to .pdf routine and it is not working. Here are the plot settings. Any ideas? (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 Quote Link to comment Share on other sites More sharing options...
rlx Posted April 9, 2018 Share Posted April 9, 2018 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... Quote Link to comment Share on other sites More sharing options...
GregGleason Posted April 9, 2018 Author Share Posted April 9, 2018 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 Quote Link to comment Share on other sites More sharing options...
BrianTFC Posted April 9, 2018 Share Posted April 9, 2018 GregGleason, try this. (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") ) ) ) Quote Link to comment Share on other sites More sharing options...
rlx Posted April 9, 2018 Share Posted April 9, 2018 Probably Brian's suggestion will work so just show where you went wrong: to make the file name try his : (setq file (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf")) also : (setq s (getstring (strcat "\nEnter Filename for Save <" (getvar 'file) "> : "))) file is not a system variable so it should be : (setq s (getstring (strcat "\nEnter Filename for Save <" file "> : "))) hope this helps gr. Rlx Quote Link to comment Share on other sites More sharing options...
Grrr Posted April 9, 2018 Share Posted April 9, 2018 2c - I'd store the file lisp variable like this: (setq file (apply '(lambda (a b c) (strcat a b ".pdf")) (fnsplitl (apply 'strcat (mapcar 'getvar '(dwgprefix dwgname)))))) Quote Link to comment Share on other sites More sharing options...
rlx Posted April 9, 2018 Share Posted April 9, 2018 2c - I'd store the file lisp variable like this: (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 Quote Link to comment Share on other sites More sharing options...
Grrr Posted April 9, 2018 Share Posted April 9, 2018 make it 20 dollar cause never seen this construct haha Haha.. cheers! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 10, 2018 Share Posted April 10, 2018 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. GETVALS3.lsp plotA3Pdfrange2.lsp mergepdfs.lsp Quote Link to comment Share on other sites More sharing options...
rlx Posted April 10, 2018 Share Posted April 10, 2018 AH! now the biting makes sense! fnsplitl is a real function.... Quote Link to comment Share on other sites More sharing options...
GregGleason Posted April 10, 2018 Author Share Posted April 10, 2018 GregGleason, try this. (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") ) ) ) That worked great BrianTFC! I appreciate the help. Greg Quote Link to comment Share on other sites More sharing options...
GregGleason Posted April 10, 2018 Author Share Posted April 10, 2018 Probably Brian's suggestion will work so just show where you went wrong: to make the file name try his : (setq file (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".pdf")) also : (setq s (getstring (strcat "\nEnter Filename for Save <" (getvar 'file) "> : "))) file is not a system variable so it should be : (setq s (getstring (strcat "\nEnter Filename for Save <" file "> : "))) hope this helps gr. Rlx I appreciate you taking the time to show me these. THIS is how I learn. Kudos to you, rlx! Greg Quote Link to comment Share on other sites More sharing options...
rlx Posted April 10, 2018 Share Posted April 10, 2018 Glad both me and BrianTFC were able yo help you Quote Link to comment Share on other sites More sharing options...
BrianTFC Posted April 10, 2018 Share Posted April 10, 2018 Greg, Your welcome Greg!! I've leaned a lot from everyone on this site and I'm glad I could finally help someone on here. Brian Quote Link to comment Share on other sites More sharing options...
masterfal Posted April 23, 2019 Share Posted April 23, 2019 (edited) finally managed to get this all setup and working properly using the getvals, plota3pdfrange etc. one thing i noticed with the merging of the pdf's though, it seems to change the appearance of symbols in text. my diameter symbol for example looks fine in the individual sheets but once combined it changes.. single pdf sheet like this: after its combined it looks like this: anyone know how to fix this? I've got latest version of ghostscript installed Edited April 23, 2019 by masterfal Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 23, 2019 Share Posted April 23, 2019 Are you using the %%c for the diameter ? You may need to use the correct alt+ octal code for the diameter symbol, it is in Mtext. Quote Link to comment Share on other sites More sharing options...
masterfal Posted April 23, 2019 Share Posted April 23, 2019 yeh usually use %%c. it only happens when i use the arial font. if i change to calibri it works. need to use arial though as thats our standard style.. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 24, 2019 Share Posted April 24, 2019 (edited) Trying to remember pretty sure arial has a diameter symbol. Go to mtext pretyy sure the key code is there. Go down to other and it will open the font map need to work out the key number. Edited April 24, 2019 by BIGAL Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.