Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with updating a Lisp script file that plots drawings to a printer

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
mmartin
632 Views, 6 Replies

Help with updating a Lisp script file that plots drawings to a printer

AutoCAD 2014 on Win 7 Pro 64-bit

Hello, I'm new to this forum and have no experience with the Lisp language, though I do have years of experience with programming. We have a script that was written about 13 years ago that seemed to work fine until we replaced the printer that it used. Now we are receiving many errors and I'm not sure what, exactly, needs to change in the script.

Here are the error messages:

Command: PRINTOUT

Enter number of pages to print: 1

Unknown command "INCHES".  Press F1 for help.

Unknown command "L".  Press F1 for help.

Unknown command "N".  Press F1 for help.

Unknown command "W".  Press F1 for help.

Unknown command "FIT".  Press F1 for help.

Unknown command "C".  Press F1 for help.

Unknown command "Y".  Press F1 for help.

Unknown command "CTB".  Press F1 for help.

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 "Y".  Press F1 for help

 

Here is the script:

 

;;;  1/26/01 am 12/23/05 updated to work with 2006 jcc
;;; 11/13/09 update printer name for new IP's
(defun c:printout ()
(setq pgs (getint "Enter number of pages to print: ")) ; pgs = number of pages to print
  (setvar "cmdecho" 0) ; Turn command Echo off
  (setq cpg 1)  ; Set current page to 1
  (setq bottom (list 0 0)) ; Set bottom left corner of page 1
  (setq top (list 10.5 8.0)) ; Set top right corner of page 1
  (While (<= cpg pgs) ;test for current page less than or equal to total number of pages
   (command "_.plot" "Y" "Model" "'Xerox ECD'" "Letter" "Inches" "L" "n" "w" bottom top "Fit" "c" "y" "monochrome.ctb" "y" "n" "n" "n" "y"); Print odd page
    (if (>= pgs (1+ cpg)) ; test for current page less than or equal to total number of pages
      (progn (setq bottom (list (car bottom) (+ (cadr bottom) 8.5))) ; advance bottom left corner for plot window
      (setq top (list (car top) (+ (cadr top) 8.5))) ; advance top right corner for plot window
      (setq cpg (1+ cpg)) ; add one to current page number
      (command "_.plot" "Y" "Model" "'Xerox ECD'" "'Letter (8.5 x 11)'" "Inches" "L" "n" "w" bottom top "Fit" "c" "y" "monochrome.ctb" "y" "n" "n" "n" "y"); print even page
      (setq bottom (list (+ (car bottom) 11.5) 0.0)); advance bottom left corner for plot window
      (setq top (list (+ (car top) 11.5) 8.0)); advance top right corner for plot window
      ); close progn
    ); close if statement
    (setq cpg (1+ cpg)); add one to current page number

 

  ); close while loop
  (princ); exit quietly
); close function

 

Any help and direction you can provide would be greatly appreciated.

6 REPLIES 6
Message 2 of 7
lgabriel
in reply to: mmartin

The following line in your program is what tells the printer what to do:

 

(command "_.plot" "Y" "Model" "'Xerox ECD'" "Letter" "Inches" "L" "n" "w" bottom top "Fit" "c" "y" "monochrome.ctb" "y" "n" "n" "n" "y")

 

First of all, is the new printer driver called "Xerox ECD". If not you will need to change it to the AutoCAD driver that is designated for your new printer.

 

If it is correct, you need to manually plot one drawing file to your new printer without having the printer dialog box appear. To do this type: -PLOT at the command prompt.

 

The next prompt will ask: Detailed plot configuration? [Yes/No] <No>:  Enter Yes 

 

What will happen next is AutoCAD will prompt a series of configuration questions. As you answer these questions, write down each response in order.

 

Once you have gone through all of the prompts and your drawing prints properly, revise the Autolisp line of code, shown above, with the new responses in the correct order.

 

If done right, the program should automatically print your drawing files. Note, you will need to make the changes for both Odd and Even pages

Message 3 of 7
Ajilal.Vijayan
in reply to: mmartin

The program fails at below line because the new plotter dont have a paper size called 'Letter'.

 

(command "_.plot" "Y" "Model" "'Xerox ECD'" "Letter" "Inches" "L" "n" "w" bottom top "Fit" "c" "y" "monochrome.ctb" "y" "n" "n" "n" "y")

 

Replace the paper size Letter with something that is available on the current printer/plotter.

 

Message 4 of 7
mmartin
in reply to: lgabriel

That was excellent advice. I did a manual plot as you described and wrote the answers down for each question. Yes, Xerox ECD was the correct printer and I have an AutoCAD driver for it. Now, comes the part I'm not sure how to do in the lisp file. The paper size on this printer is called Letter (8.5 x 11"). How do I get it to recognize the literal " without confusing the rest of the statement? The statement, again, is:

(command "_.plot" "Y" "Model" "Xerox ECD" "Letter" "Inches" "L" "n" "w" bottom top "Fit" "c" "y" "monochrome.ctb" "y" "n" "n" "n" "y")

 

Also, I notice that the file uses command "_.plot" instead of "-plot". Does that make any difference?

 

Thank you, again!

Message 5 of 7
mmartin
in reply to: mmartin

One additional question. Something changed in the plot options since the program was originally written. After the monochrome.ctb selection the options are:

Print with lineweights which I set to Yes

(This is new for this program) Enter Shade Plot Setting: The program has an N in this place, but there is no N in the options. My options are As Displayed, Legacy Wireframe, Legacy Hidden, Visual Styles, and Rendered. Does anyone know what that option used to say? It might help me pick the correct one in the updated program.

 

Thank you!

Message 6 of 7
hmsilva
in reply to: mmartin

For the paper try "Letter (8.5 x 11\")"
for the shade plot settings "As Displayed"

Henrique

EESignature

Message 7 of 7
mmartin
in reply to: hmsilva

Thank you. I found that I actually need to set it to "Letter (8.5 x 11\"\)" otherwise the right paren was closing the statement at the wrong place. I'm going to try the As Displayed next. The program is working again, but the left side line isn't displaying.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost