PageSetup Lisp

PageSetup Lisp

francine.zimmermannSRSWJ
Advocate Advocate
711 Views
7 Replies
Message 1 of 8

PageSetup Lisp

francine.zimmermannSRSWJ
Advocate
Advocate

I have a Lisp CH-A.LSP with different pagesetup command.

;;
(defun C:CH-A0-L()
(command "_-PAGESETUP" "DWG To PDF_font_to_geometry.pc3" "ISO full bleed A0 (841.00 x 1189.00 MM)" "" "L" "N" "L" "1:1" "0.00,0.00" "Y" "KGC_PLOT_STYLE" "Y" "Y" "N" "N")
(princ)
)
;;
(defun C:CH-A0-P()
(command "_-PAGESETUP" "DWG To PDF_font_to_geometry.pc3" "ISO full bleed A0 (841.00 x 1189.00 MM)" "" "P" "N" "L" "1:1" "0.00,0.00" "Y" "KGC_PLOT_STYLE" "Y" "Y" "N" "N")
(princ)
)
;;

The Lisp works fine, but by using the macro in my Ribbon, the command line contains a text that I didn't call up.
I think my lisp isn't written properly.

Macro example: ^C^C(load "CH-A.lsp");CH-A2-P; 

Command: (LOAD "CH-A.LSP")

C:CH-A4-P   this text is strange because I don't call it

Command: CH-A2-P _-PAGESETUP Enter an output device name or .......

 

Thank you in advance for your help

0 Likes
Accepted solutions (2)
712 Views
7 Replies
Replies (7)
Message 2 of 8

paullimapa
Mentor
Mentor

that's because it's reporting the last defun statement you have in your lisp which shows CH-A4-P:

(defun C:CH-A4-P()
 (command "_-PAGESETUP" "DWG To PDF_font_to_geometry.pc3" "ISO full bleed A4 (210.00 x 297.00 MM)" "" "P" "N" "L" "1:1" "0.00,0.00" "Y" "KGC_PLOT_STYLE" "Y" "Y" "N" "N")
(princ)
)

 If you don't want to see this then add this as the last line in the lisp file:

(princ)

Also this pagesetup sequence only works in Paper space. The sequence changes a bit towards the end in Model. So you may want to add the code to switche to paper space in each one of the defun statements like this one:

(defun C:CH-A4-P()
 (setvar"TILEMODE"0) ; make sure is set in paper space 
(command "_-PAGESETUP" "DWG To PDF_font_to_geometry.pc3" "ISO full bleed A4 (210.00 x 297.00 MM)" "" "P" "N" "L" "1:1" "0.00,0.00" "Y" "KGC_PLOT_STYLE" "Y" "Y" "N" "N")
(princ)
)

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

francine.zimmermannSRSWJ
Advocate
Advocate

I have modified the lisp in accordance with your comments but it change nothing2024-02-07 19_37_08-AutoCAD Text Window - Drawing1.dwg.png

0 Likes
Message 4 of 8

paullimapa
Mentor
Mentor

repost your changed lisp so we can see the changes you made


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

francine.zimmermannSRSWJ
Advocate
Advocate

I reposted it

0 Likes
Message 6 of 8

paullimapa
Mentor
Mentor
Accepted solution

again this is the end of the file as you show it now:

 

(defun C:CH-A4-P()
 (setvar"TILEMODE"0) ; make sure is set in paper space 
(command "_-PAGESETUP" "DWG To PDF_font_to_geometry.pc3" "ISO full bleed A4 (210.00 x 297.00 MM)" "" "P" "N" "L" "1:1" "0.00,0.00" "Y" "KGC_PLOT_STYLE" "Y" "Y" "N" "N")
(princ)
)

 

I don't see the additional princ function statement added as the last line of the entire file not just within the defun statement. So when you add this as the last line that would give you a clean load like this:

 

(defun C:CH-A4-P()
 (setvar"TILEMODE"0) ; make sure is set in paper space 
(command "_-PAGESETUP" "DWG To PDF_font_to_geometry.pc3" "ISO full bleed A4 (210.00 x 297.00 MM)" "" "P" "N" "L" "1:1" "0.00,0.00" "Y" "KGC_PLOT_STYLE" "Y" "Y" "N" "N")
(princ)
)
(princ) ; clean load

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 7 of 8

francine.zimmermannSRSWJ
Advocate
Advocate
Perfect ‌‌ 
Thanks a lot
0 Likes
Message 8 of 8

paullimapa
Mentor
Mentor
Accepted solution

Glad to have helped...Now you could also include a prompt letting the user know that the code loaded successfully like this:

(princ"\nCH-A.lsp Pagesetups Loaded Successfully.")
(princ) ; clean exit

 


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