AQucsaiJr Posted July 5, 2011 Share Posted July 5, 2011 I am trying to make a one step procedure for a common plot used in my office. I created a basic LISP to perform the task so that anyone in the office could use it and get the same results. My problem is I keep getting an error message that tells me the output device I want to use cannot be found. Could someone take a look at my LISP and see if there is something I am doing wrong? This LISP works in AutoCAD 2010 but I get this error when working in AutoCAD 2009. Most of the users in the office are on 2009. CANON_ARCH-D_FLW - example.lsp Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted July 5, 2011 Author Share Posted July 5, 2011 Should have posted the LISP this way for easy reading... ;;Purpose: This command will auto-plot an ARCH-D size print to the canon plotter with a user specified plot scale (DEFUN C:Archd (/ scale ) (setq scale (getstring "Enter Plot Scale: ")) (command "-plotstamp" "off" "") (COMMAND "-PLOT" "YES" "model" "\\PGEFS01\\WORKGROUP\\AUTOCAD\\PLOT FILES\\CANON IPF600 ARCH-D.PC3" "" "INCHES" "LANDSCAPE" "NO" "EXTENTS" scale "CENTER" "YES" "FP-Lineweights.CTB" "YES" "AS DISPLAYED" "NO" "NO" "YES") (PRINC) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 6, 2011 Share Posted July 6, 2011 Is plotstamp in 2009 can not remember if not you can do a version check "acadver" last number is what you want 2011=18.1 and not run (if ((lambda (vrsn) (cond ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09 ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10 ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11 ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ? ((alert "This version of C3D not supported!")) ) ) (vlax-product-key) ) ; end if condition progn is true Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted July 6, 2011 Author Share Posted July 6, 2011 Yes, plotstamp is supported in 2009. The part of the LISP 2009 gets hung up on is finding the output device. I want it to locate a (.pc3) file that I have already set up on the server, which all users have access to. However this is not working for me. It works perfectly fine in 2010 but can not be located in 2009. Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 6, 2011 Share Posted July 6, 2011 This is what I use and it works across the office: ;Based on PageSetups from Alan J. Thompson (defun c:A1 () (PlotReactorOFF) (if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") (progn (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A1") (while (wcmatch (getvar "cmdnames") "*PSETUPIN*") (command "_yes") ) ;_ while T ) ;_ progn ) ;_ if (command "-plot" "n" "" "A1" "" "n" "y" "n") (command "_-purge" "a" "*" "N") (setq CCC_Sheet "A1") (command "updatefield" "all" "") (command "regenall") (command "_zoom" "e") (initdia) (command "._plot") (PlotReactorON) ;(princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun PlotReactorON nil (vl-load-com) ;; © Lee Mac 2010 ( (lambda ( data foo / react ) (if (setq react (vl-some (function (lambda ( reactor ) (if (eq data (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-command-reactor) ) ) ) (if (not (vlr-added-p react)) (vlr-add react) ) (setq react (vlr-command-reactor data (list (cons :vlr-commandwillstart foo) ) ) ) ) (if (vlr-added-p react) (princ "\n** Reactor Activated **") (princ "\n** Reactor Failed to Activate **") ) react ) "Plot-Reactor" 'Plot-Callback ) (princ) ) (defun PlotReactorOFF nil (vl-load-com) ;; © Lee Mac 2010 ( (lambda ( data foo / react ) (if (setq react (vl-some (function (lambda ( reactor ) (if (eq data (vlr-data reactor)) reactor) ) ) (cdar (vlr-reactors :vlr-command-reactor) ) ) ) (if (vlr-added-p react) (vlr-remove react) ) ) (if (or (not react) (not (vlr-added-p react))) (princ "\n** Reactor Deactivated **") (princ "\n** Reactor Failed to Deactivate **") ) react ) "Plot-Reactor" 'Plot-Callback ) (princ) ) (defun Plot-Callback ( reactor arguments ) (vl-load-com) (if (eq (strcase (car arguments)) "PLOT") (LM:Popup "Warning" 64 "Gotcha!!! Please use the NNRDO Plot tools when plotting standard layouts!!") ) (princ) ) (defun LM:Popup ( title flags msg / WSHShell result ) ;; © Lee Mac 2010 (setq WSHShell (vlax-create-object "WScript.Shell")) (setq result (vlax-invoke WSHShell 'Popup msg 0 title flags)) (vlax-release-object WSHShell) result ) Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted July 7, 2011 Author Share Posted July 7, 2011 @woodman - I have not been able to get your LISP to work for what I need. Thank you for the LISP though. I will continue to work on it. I have figured out how to get 2009 to recognize the output device but now I have another problem. I don't know how to get the paper size to change to what I want. (DEFUN C:Archc (/ scale ) (setq scale (getstring "Enter Plot Scale: ")) (setq name (findfile "w:/AUTOCAD/PLOT FILES/CANON IPF600 ARCH-c.PC3")) (command "-plotstamp" "off" "") (COMMAND "-PLOT" "YES" "model" NAME "[i][color=black]Paper Size[/color][/i]" "INCHES" "LANDSCAPE" "NO" "EXTENTS" scale "CENTER" "YES" "FP-Lineweights.CTB" "YES" "AS DISPLAYED" "NO" "NO" "YES") (PRINC) ) The output I need is "ARCH C (18"x24")" however I can not figure out a way to get that to work because of the Parentheses in the name. Anyone know of a way I can do this? Maybe a setq variable or something of that nature?? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 7, 2011 Share Posted July 7, 2011 The problem is not the parentheses, but rather the extra apostrophes in the string, you will need to prefix these with a backslash escape character to mark them as literals. "ARCH C (18\"x24\")" You can realise the correct syntax when using code editors which offer syntax highlighting such as the Visual LISP IDE, Notepad++, etc. Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted July 7, 2011 Author Share Posted July 7, 2011 I apologize, I meant the apostrophes. Thanks Lee Mac I'll give this a go. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 7, 2011 Share Posted July 7, 2011 This will give you a more complete explanation of the concept: http://en.wikipedia.org/wiki/Escape_character Quote Link to comment Share on other sites More sharing options...
woodman78 Posted July 8, 2011 Share Posted July 8, 2011 I don't set the paper size in the lisp. I have created page setups and call them from the lisp. They are stored in the template drawing. I have 1 template size for A1 and A3 and when the user calls either A1 or A3 plot the lisp loads a different page setup. I have done the same for pdf's as well. For us it works very well. Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted July 8, 2011 Author Share Posted July 8, 2011 I have never tried to use a template file to do the settings for a print before. I will have to look into that. Thanks for the information. 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.