Plotting Lisp not functioning properly

Plotting Lisp not functioning properly

trevorDXYHC
Observer Observer
408 Views
4 Replies
Message 1 of 5

Plotting Lisp not functioning properly

trevorDXYHC
Observer
Observer

At my office, we use a plotting lisp to set up different sheet sizes. The lisp is working on most computers, but has decided to not work on my computer (AutoCad 2024). Here's the lisp just in case anyone wants to figure out if there's something wrong.

Keep in mind, the lisp has worked just fine for me for nearly 2 years, but one day with no apparent changes made to ACAD or the lisp, has stopped working.

 

(defun c:1117 (/ lname)
(setvar "cmdecho" 1)
(setq lname (getvar "ctab"))
(command "-plot" "y" lname "PRINTERNAME" "Ledger" "i" "l" "n" "e" "1=2.5" "c" "y" "PLOTSTYLE" "y" "y" "n" "n" "n" "y" "n")
(princ)
);defun c:

 

Just replace PRINTERNAME and PLOTSTYLE with actual values.

 

ACAD gave me the error "unkown command "Y"" and so on for everything after the plot table. I've set cmdecho to 1  in order to see where the lisp is failing, and after the PLOTSTYLE, it no longer asks for the y/n questions.

 

If I manually type in each of the commands from the lisp, it asks each appropriate question, making the lisp work in theory, but the moment the lisp tries to run it, no more questions after asking for the plot style.

 

Of course, there may be other factors being played that I am unaware of, but any help would be greatly appreciated.

 

0 Likes
Accepted solutions (1)
409 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor

are you running this lisp in model or layout?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 5

paullimapa
Mentor
Mentor
Accepted solution

Here are some additional observations assuming you are in Layout when you run this lisp function because it will fail if you're in Model:

1. Your current plot sequence:

paullimapa_0-1689040856885.png

2. If the plot sequence is for a plot device (*.pc3) that sends the job directly to the plotter & not save to file, then the code should look like this:

 

(setq lname (getvar "ctab"))    ; must be a layout tab & not Model
(command "-plot" 
 "y"                            ; Detailed plot configuration? [Yes/No]
 lname                          ; layout name
 "Fax"                          ; Enter an output device name or [?]
 "Letter"                       ; Enter paper size or [?]
 "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] 
 "1=2.5"                        ; Enter plot area [Display/Extents/Layout/View/Window] 
 "c"                            ; Enter plot offset (x,y) or [Center]
 "y"                            ; Plot with plot styles? [Yes/No] 
 "Monochrome.ctb"                ; Enter plot style table name or [?] (enter . for none)
 "y"                            ; Plot with lineweights? [Yes/No]
 "y"                            ; Scale lineweights with plot scale?
 "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]
)

 

2. The plot sequence would be different when you're using a plot device like Dwg To Pdf.pc3 which generates a pdf file. Assuming you want the pdf name to match with the current drawing name and saved in the current drawing folder, you'll need to delete the pdf file first if it exists in the current folder before plotting:

 

; set plot file name
(setq dwgname (strcat (getvar"dwgprefix")(vl-filename-base (getvar"dwgname")) ".pdf"))    
; if plot file name exists, delete so plot sequence can finish successfully
(if(findfile dwgname)(vl-file-delete dwgname)) 
(setq lname (getvar "ctab"))    ; must be a layout tab & not Model
(command "-plot" 
 "y"                            ; Detailed plot configuration? [Yes/No]
 lname                          ; layout name
 "DWG To PDF.pc3"               ; Enter an output device name or [?]
 "ANSI A (11.00 x 8.50 Inches)" ; Enter paper size or [?]
 "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] 
 "1=2.5"                        ; Enter plot area [Display/Extents/Layout/View/Window] 
 "c"                            ; Enter plot offset (x,y) or [Center]
 "y"                            ; Plot with plot styles? [Yes/No] 
 "Monochrome.ctb"                ; Enter plot style table name or [?] (enter . for none)
 "y"                            ; Plot with lineweights? [Yes/No]
 "y"                            ; Scale lineweights with plot scale?
 "n"                            ; Plot paper space first? [Yes/No]
 "n"                            ; Hide paperspace objects? [Yes/No] 
 dwgname                        ; Enter file name 
 "n"                            ; Save changes to page setup 
 "y"                            ; Proceed with plot [Yes/No]
)

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 5

Sea-Haven
Mentor
Mentor

"you'll need to delete the pdf file first " pretty sure if ran again will overwrite. 

Message 5 of 5

paullimapa
Mentor
Mentor

Another observation: Make sure you are putting a PLOTSTYLE that actually exists in your AutoCAD program. I noticed that a minor spelling discrepancy like instead of monochrome.ctb I put monchrome.ctb which is missing an “o” this will cause the plot sequence to fail exactly the way you’ve described. 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes