mwade93 Posted February 7, 2014 Share Posted February 7, 2014 I am working on a computer at the office with full AutoCAD on it and I am trying to write a LISP routine for people that have the ability to use it. However, the actual plotting part of it is not working. I can get the PDF part to work, here is where the issue is: (defun c:DPA () (foreach lay (layoutlist) (setvar 'CTab lay) (COMMAND "-plot" "y" "" "FED.pc3" "Letter" "Inches" "Landscape" "n" "Extents" "1=1" "Center" "y" "don.ctb" "y" "n" "n" "n" "n" "y" ) ) ) I have not done LISP in about a year, my first attempt at the office. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 7, 2014 Share Posted February 7, 2014 Most probably there is an icorrect input. Is that FED.pc3 configuration available and valid? Please make sure that CMDECHO system variable is set to 1 and run your code; when fails press to see where it failed and why. To ensure that all inputs were the right ones, call the -PRINT (that it, the prompter version) command and note down the required answers. Quote Link to comment Share on other sites More sharing options...
mostafa badran Posted February 7, 2014 Share Posted February 7, 2014 8)you should take look in here http://autocadtips.wordpress.com/2013/09/17/autolisp-print-all-layout-tabs/ Quote Link to comment Share on other sites More sharing options...
mwade93 Posted February 7, 2014 Author Share Posted February 7, 2014 Most probably there is an icorrect input. Is that FED.pc3 configuration available and valid?Please make sure that CMDECHO system variable is set to 1 and run your code; when fails press to see where it failed and why. To ensure that all inputs were the right ones, call the -PRINT (that it, the prompter version) command and note down the required answers. The pc3 file is available. I have an identical format one for PDFs that work perfectly fine. Mostafa, that is the one I used actually. For pdfs it works perfect, for actual paper plotting, not so much as of yet. Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 7, 2014 Share Posted February 7, 2014 What is the message issued when your code failed? Quote Link to comment Share on other sites More sharing options...
mwade93 Posted February 7, 2014 Author Share Posted February 7, 2014 Command: Command: Command: DPA -plot Detailed plot configuration? [Yes/No] : y Enter a layout name or [?] : Enter an output device name or [?] : FED.pc3 Enter paper size or [?] : Letter Enter paper units [inches/Millimeters] : Inches Enter drawing orientation [Portrait/Landscape] : Landscape Plot upside down? [Yes/No] : n Enter plot area [Display/Extents/Layout/View/Window] : Extents Enter plot scale (Plotted Inches=Drawing Units) or [Fit] : 1=1 Enter plot offset (x,y) or : Center Plot with plot styles? [Yes/No] : y Enter plot style table name or [?] (enter . for none) : don.ctb Plot with lineweights? [Yes/No] : y Scale lineweights with plot scale? [Yes/No] : n Plot paper space first? [Yes/No] : n Hide paperspace objects? [Yes/No] : n Write the plot to a file [Yes/No] : n Save changes to page setup [Yes/No]? y Proceed with plot [Yes/No] : Regenerating layout. Regenerating model - caching viewports. -plot Yes or No, please. ; error: Function cancelled It is sitting on command line waiting for me to confirm I want to continue with plot. Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 7, 2014 Share Posted February 7, 2014 Seem that you need to just add an answer to the last prompt! Proceed with plot [Yes/No] ... "n" "n" "y" [color=red]"y"[/color] ) ) ) Quote Link to comment Share on other sites More sharing options...
mwade93 Posted February 10, 2014 Author Share Posted February 10, 2014 Seem that you need to just add an answer to the last prompt! ... "n" "n" "y" [color=red]"y"[/color] ) ) ) Let me try that again. I already tried that once. Quote Link to comment Share on other sites More sharing options...
tmelancon Posted February 10, 2014 Share Posted February 10, 2014 I find this useful at my office. However, what should be added to the end if I wanted to switch back to modelspace, save, then close out of the drawing. All using this same routine. Thanks guys. Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2014 Share Posted February 10, 2014 However, what should be added to the end if I wanted to switch back to modelspace, save, then close out of the drawing. I suppose that this a question, so you are looking for something like this: (setvar "CTAB" "MODEL") (if (= (getvar "DWGTITLED") 1) (command "_QSAVE" "_CLOSE") ) Quote Link to comment Share on other sites More sharing options...
mwade93 Posted February 10, 2014 Author Share Posted February 10, 2014 The extra y worked. Thank you Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2014 Share Posted February 10, 2014 Glad to hear that; you're welcome! Quote Link to comment Share on other sites More sharing options...
tmelancon Posted February 10, 2014 Share Posted February 10, 2014 I just tried it and although it printed all of them properly, it went back to Layout 1. It didnt switch back to model, save and close. Here is what I have: (defun c:DPA () (foreach lay (layoutlist) (setvar 'CTab lay) (COMMAND "-plot" "n" "Drawing1" "" "Brother HL-5370DW series" "n" "n" "y" ) ) ) (setvar "CTAB" "MODEL") (if (= (getvar "DWGTITLED") 1) (command "_QSAVE" "_CLOSE") ) Seems funny looking. Quote Link to comment Share on other sites More sharing options...
tmelancon Posted February 10, 2014 Share Posted February 10, 2014 Update: I ran the code and it simply printed Layout1 over and over again. Then stayed on Layout1. I need it to print all layouts then switch back to model, close, and save. Some drawings have on 1 layout while others have 8. Can you help? Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2014 Share Posted February 10, 2014 Please pay attention that you placed the code I suggested outside DPA command definition, so, it will not be executed. Although, I'm not sure what make it look "funny". Quote Link to comment Share on other sites More sharing options...
tmelancon Posted February 10, 2014 Share Posted February 10, 2014 Thats it! I knew something looked "funny". Meaning it just didnt look right. I have now moved it into the definition and just tested it. Although, it is still not printing all the layouts. I need to lisp to look for and plot however many may be in any given drawing. Some have 3 layouts, others have 8. Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2014 Share Posted February 10, 2014 Although, it is still not printing all the layouts. Seems that you are forcing the plot of a layout named "Drawing1"; please consider using "" ( to plot current one) or the lay variable instead: ... (setvar 'CTab lay) (COMMAND "-plot" "n" [color=red][s]"Drawing1"[/s] ""[/color] ... Quote Link to comment Share on other sites More sharing options...
tmelancon Posted February 10, 2014 Share Posted February 10, 2014 Last time I will bug you MSasu. The code works just as I would like but is only plotting the first layout. Can you doctor the code please? (defun c:DPA () (foreach lay (layoutlist) (setvar 'CTab lay) (COMMAND "-plot" "n" "" "" "Brother HL-5370DW series" "n" "n" "y" ) (COMMAND "CTAB" "MODEL") (command "_QSAVE" "_CLOSE") ) ) thanks a bunch! Quote Link to comment Share on other sites More sharing options...
MSasu Posted February 10, 2014 Share Posted February 10, 2014 Please pay attention that you have placed the closing code inside FOREACH cycle, so the second and following others layouts will be never reached. Quote Link to comment Share on other sites More sharing options...
tmelancon Posted February 10, 2014 Share Posted February 10, 2014 I keep getting this error? I am out of it today! I cannot seem to get it! Can you complete it and submit? Error: malformed list on input 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.