woodman78 Posted February 15, 2013 Posted February 15, 2013 I have been trying to automate the process of plotting multiple drawings to pdf but without using the exportpdf command. I find the quality to be poor and I have had issued with fields not being updated etc. So I was looking at the possibility of automating CutePDF Writer and I found this article.. http://www.codeproject.com/Articles/46592/Using-the-Free-CutePDF-Writer-without-User-Interve The problem is that I don't know how to use it. And my knowledge of code is, to be fair, brutal. Does anyone know or can anyone tell me if there is a way to run this from a lisp so that the pdf gets saved in the given folder... Thanks. Quote
BrianTFC Posted February 15, 2013 Posted February 15, 2013 Give this a try. ;;; PDF's All Tabs to source drawing folder with Tab name. (defun c:pdf ( / *error* cm fd ) (defun *error* ( msg ) (if (= 'int (type cm)) (setvar 'cmdecho cm) ) (if (= 'int (type fd)) (setvar 'filedia fd) ) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) (foreach layoutname (vl-remove "Model" (layoutlist)) (command "._layout" "set" layoutname) (progn (setq fd (getvar 'filedia) cm (getvar 'cmdecho) ) (setvar 'filedia 0) (setvar 'cmdecho 0) (command "-plot" "_Y" ;; Detailed plot configuration? [Yes/No]: "" ;; Enter a layout name <Current-Layout>: "dwg to PDF" ;; Enter an output device name: "ARCH expand C (18.00 x 24.00 Inches)" ;; Enter paper size: "_I" ;; Enter paper units [inches/Millimeters]: "_L" ;; Enter drawing orientation [Portrait/Landscape]: "_N" ;; Plot upside down? [Yes/No]: "_E" ;; Enter plot area [Display/Extents/Layout/View/Window]: "_F" ;; Enter plot scale (Plotted Inches=Drawing Units) or [Fit] <1=1>: "_C" ;; Enter plot offset (x,y) or [Center]: "_Y" ;; Plot with plot styles? [Yes/No]: "TFC.ctb" ;; Enter plot style table name (enter . for none): "_Y" ;; Plot with lineweights? [Yes/No]: "_N" ;; Scale lineweights with plot scale? [Yes/No]: "_N" ;; Plot paper space first? [Yes/No]: "_N" ;; Hide paperspace objects? [Yes/No]: (strcat ;; Enter file name: (getvar 'dwgprefix) (cadr (fnsplitl (getvar 'dwgname))) "-" (getvar 'ctab) ".pdf" ) "_N" ;; Save changes to page setup [Yes/No]: "_Y" ;; Proceed with plot [Yes/No]: ) (setvar 'cmdecho cm) (setvar 'filedia fd) ) (princ "\nCommand not available in Modelspace.") ) (princ) ) Quote
Bill Tillman Posted February 15, 2013 Posted February 15, 2013 I use the same method that BrianTFC outlined above. It works great and I use the "dwgn to PDF" driver built-in with AutoCAD. I tried it using the PDFCreator driver but as I recall there were some troubles with it. This method works very well but be sure you get the paper size text set just right. They come in very long, obscure names like "arch full bleed D (24.00 x 36.00 inches)" and you have to enter it just like that or it will not work. You can find these in the drop down menu when you look at the paper sizes manually. Then when your code runs it will select the correct size to print to. Oh yes, I remember one of the other problems with the PDFCreator driver was it printed ok, but the file ended up rotated to the right 90°. This caused the users to complain and as I recall there were some resolution issues. The "dwgn to PDF" driver took care of these two issues. Quote
Lee Mac Posted February 16, 2013 Posted February 16, 2013 http://www.cadtutor.net/forum/showthread.php?76811-Print-only-one-layout&p=518578&viewfull=1#post518578 Quote
BIGAL Posted February 16, 2013 Posted February 16, 2013 I have used cutepdf for a few years pick 1 button plots all layouts I have posted numerous times the code will find page else search PDF+BIGAL . http://www.cadtutor.net/forum/showth...=Printing-LISP this is an example there are a few different versions of this here. Quote
woodman78 Posted February 18, 2013 Author Posted February 18, 2013 BrianTFC, I keep getting an error saying "Command not available in Modelspace." I am definitely in Paperspace though. Any ideas? Edit: This is the command line dump: Command: PDF1 ._layout Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: set Enter layout to make current <1>: 1 Command: Unknown command "Y". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "PDF". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "Y". Press F1 for help. Command not available in Modelspace.._layout Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: set Enter layout to make current <1>: Layout2-1 Regenerating layout. Regenerating model - caching viewports. Command: Unknown command "Y". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "PDF". Press F1 for help. Unknown command "N". Press F1 for help. Unknown command "Y". Press F1 for help. Command not available in Modelspace. Further Edit: It's like it skipping over the plot command Quote
woodman78 Posted February 18, 2013 Author Posted February 18, 2013 No worries. I found my mistake. Quote
Lee Mac Posted February 19, 2013 Posted February 19, 2013 BrianTFC, I keep getting an error saying "Command not available in Modelspace." I am definitely in Paperspace though. Any ideas? The original program was written to plot only the current layout, hence there is a statement to test whether a paperspace layout is active when running the program. BrianTFC has incorrectly altered my code in an attempt to plot all layouts. Quote
BrianTFC Posted February 19, 2013 Posted February 19, 2013 Lee, Yes i altered your code to make it plot all layouts, Actually it works great. if you look at the thread above yours you see that woodman78 found his mistake. Isn't the object of coding to put different codes together to get a routine that you want for what you need? Quote
Lee Mac Posted February 19, 2013 Posted February 19, 2013 Yes i altered your code to make it plot all layouts, Actually it works great. if you look at the thread above yours you see that woodman78 found his mistake. Isn't the object of coding to put different codes together to get a routine that you want for what you need? The message being printed is not woodman78's mistake, this message will always be printed since the modified code still includes part of the original if statement, hence my point about the code being modified incorrectly. Quote
BrianTFC Posted February 19, 2013 Posted February 19, 2013 The mistake that Woodman78 is refering to has nothing to do with the if statement , it had to do with his plot settings. All i did was change it from printing the current tab to a PDF to print all of tabs to a PDF. Like i said it works just fine. Quote
Lee Mac Posted February 19, 2013 Posted February 19, 2013 Like i said it works just fine. Sure it does. BrianTFC, I keep getting an error saying "Command not available in Modelspace." I am definitely in Paperspace though. Any ideas Quote
BrianTFC Posted February 19, 2013 Posted February 19, 2013 My apologies i thought the "Command not available in Modelspace." was a message to let people know that it doesn't work in modelspace. The error's i was refering to were the "unknown......" error's which was his plot setting. Quote
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.