JeepMaster Posted February 23, 2009 Share Posted February 23, 2009 Can someone help me out on creating this lisp. Sometimes when I need to print a set of drawings, I would go PLOT, select my page setup, then PREVIEW to double check, then PLOT. After that on the rest of the drawings, I would do PLOT, select page setup "PREVIOUS PLOT", PREVIEW, then PLOT. Now would it be possible to go straight to PLOT PREVIEW with "Previous Plot" page setting. I know if I have the proper page setup done on all drawings, I could just click the plot preview, but there are times I need to plot with odd settings. Please help. Quote Link to comment Share on other sites More sharing options...
uddfl Posted February 23, 2009 Share Posted February 23, 2009 One way (probably not ideal, but all I can think of) would be having the LISP save the previous plot settings to the page setup, then invoke the "PREVIEW" command. (defun c:ppp () (command "-plot" "no" "" "previous plot" "" "" "y" "n") (command "preview") (princ) ) Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted February 23, 2009 Author Share Posted February 23, 2009 Thanks uddfl, I never thought of it that way. It seems to work fine. I've added an undo command so the pagesetup will not saved to the drawing. I'm pretty sure there's a better way of doing this. If anybody have something better, please post. (defun c:PPP (); Plot Preview Previous (command "undo" "be") (command "-plot" "no" "" "previous plot" "" "n" "y" "n") (command "preview") (command "undo" "e") (command "undo" "1") (command "regenall") (princ) ) Quote Link to comment Share on other sites More sharing options...
Zorg Posted August 5, 2009 Share Posted August 5, 2009 Could you use this variation of code to action just a previous plot? If so, how? Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted August 5, 2009 Author Share Posted August 5, 2009 You mean like this. (defun c:PlotP (); Plot Previous (command "-plot" "no" "" "previous plot" "" "n" "y" "n") (princ) ) Quote Link to comment Share on other sites More sharing options...
Zorg Posted August 5, 2009 Share Posted August 5, 2009 That didn't work, it didn't give me anything Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted August 5, 2009 Author Share Posted August 5, 2009 Sorry my mistake, The last command was asking if you want to print it. I forgot it was used as a preview only before. (defun c:PlotP (); Plot Previous (command "-plot" "no" "" "previous plot" "" "n" "y" "[color=Red]y[/color]") (princ) ) It works fine now. You can also not save the page setup using this. (defun c:PlotP (); Plot Previous (command "-plot" "no" "" "previous plot" "" "n" "[color=Red]n[/color]" "[color=Red]y[/color]") (princ) ) Quote Link to comment Share on other sites More sharing options...
Zorg Posted August 6, 2009 Share Posted August 6, 2009 That works great, however when i try to combine them both into one code the print preview previous doesnt work can you explain why? (defun c:PP (); Plot Previous (command "-plot" "no" "" "previous plot" "" "n" "n" "y") (princ) ) (defun c:PPP (); Plot Preview Previous (command "undo" "be") (command "-plot" "no" "" "previous plot" "" "n" "y" "n") (command "preview") (command "undo" "e") (command "undo" "1") (command "regenall") (princ) Also, what would i need to do to incorporate a prompt on the previous plot to ask, "Do you want to Preview the plot?" & "Do you want to plot using the previous settings?" Thanks in advance Z Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted August 6, 2009 Author Share Posted August 6, 2009 You're missing a ")" in the very end of the code. (defun c:PP (); Plot Previous (command "-plot" "no" "" "previous plot" "" "n" "n" "y") (princ) ) (defun c:PPP (); Plot Preview Previous (command "undo" "be") (command "-plot" "no" "" "previous plot" "" "n" "y" "n") (command "preview") (command "undo" "e") (command "undo" "1") (command "regenall") (princ) ) You could add a new main routine and call the PP or PPP subroutine when user pick yes. But now you're making a simple task more complicated. Quote Link to comment Share on other sites More sharing options...
Zorg Posted August 7, 2009 Share Posted August 7, 2009 beautiful Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 7, 2009 Share Posted August 7, 2009 Zorg, if you use the Visual LISP Editor provided in AutoCAD to write LISP files, errors such as missed parentheses can be picked up easily - as it has a built in function to do this. Or, if you do not like the Visual LISP Editor, maybe Notepad++ or Vim. Lee Quote Link to comment Share on other sites More sharing options...
Zorg Posted August 7, 2009 Share Posted August 7, 2009 Was never sure how to use it, Lee. I don't excatly have enough time to use LISP, i only spend about 30 minutes each day in it and dont want to be doing when i get home but i'll definatley have a look into it. Thanks Z Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 7, 2009 Share Posted August 7, 2009 Here's a brief "Quick-Start" guide Open AutoCAD. Type either VLIDE or VLISP at the command line (both do the same thing). Go to File > New (don't type on the part with the "$" signs (that is the console). Start Typing your LISP file. Load it using the load button. Run it as usual. Lee 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.