First of all, I added comments to the code and called the lisp command: PltPdfH
; PltPdfH generates pdf with AutoCAD PDF (High Quality Print).pc3
; OP: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/custom-pc3-not-supported/td-p/13710861
(defun c:PltPdfH (/ cmdecho ctab filedia pdfname pltare pltctb pltdev pltlwt pltoff pltori pltppr pltscl pltsty pltuni pltupd)
(vl-load-com)
(setq cmdecho (getvar "cmdecho") ; save current settings
filedia (getvar "filedia")
ctab (getvar "ctab")
pdfname (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-" ctab ".PDF") ; pdf with layout name appended
)
(setvar "cmdecho" 0) ; suppress command echo
(setvar "filedia" 0) ; suppress file selection window
; begin command line plot sequence
(command "_.-PLOT"
"_Yes" ; Detailed plot configuration? [Yes/No]
ctab ; Enter a layout name or [?] ; or just return "" to accept current layout
"AutoCAD PDF (High Quality Print).pc3"; Enter an output device name or [?] ; "DWG To PDF.pc3" "AutoCAD PDF (General Documentation).pc3" "AutoCAD PDF (High Quality Print).pc3" "AutoCAD PDF (Smallest File).pc3" "AutoCAD PDF (Web and Mobile).pc3"
"ARCH D (24.00 x 36.00 Inches)" ; Enter paper size or [?] ; unique for selected printer device
"_Millimeters" ; Enter paper units [Inches/Millimeters] ; "_Inches"
"_Landscape" ; Enter drawing orientation [Portrait/Landscape] ; "_Portrait"
"_No" ; Plot upside down? [Yes/No]
"_E" ; Enter plot area [Display/Extents/Layout/View/Window] "_D" "_L" "_W" "_V"
"_F" ; Enter plot scale (Plotted Inches=Drawing Units) or [Fit] ; "1:1"
"_C" ; Enter plot offset (x,y) <0.00,0.00>: ; "0,0"
"_Yes" ; Plot with plot styles? [Yes/No]
"monochrome.ctb" ; Enter plot style table name or [?] (enter . for none)
"_Yes" ; Plot with lineweights? [Yes/No]
)
(if (= 1 (getvar "tilemode")) ; chk space
(command ; then model
"_A" ; Enter shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual styles/Rendered] <As displayed>:
)
(command ; else layout
"_No" ; Scale lineweights with plot scale? [Yes/No]
"_Yes" ; Plot paper space first? [Yes/No]
"_No" ; Hide paperspace objects? [Yes/No]
)
)
(command
pdfname
"_Yes" ; Save changes to page setup [Yes/No]
"_Yes" ; Proceed with plot [Yes/No]
)
(setvar "filedia" filedia) ; restore original settings
(setvar "cmdecho" cmdecho)
(princ) ; clean exit
)
I made the following changes:
1a) saved the current sys vars: cmdecho & filedia so can restore them back at end
1b) saved variable for current layout as ctab
1c) save pdf filename with current layout added at end:
(setq cmdecho (getvar "cmdecho") ; save current settings
filedia (getvar "filedia")
ctab (getvar "ctab")
pdfname (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-" ctab ".PDF") ; pdf with layout name appended
)
2) During initial plot sequence instead of checking tilemode to enter current layout:
(if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))
I just enter the current layout name using the save ctab variable:
ctab ; Enter a layout name or [?]
Or just go ahead and use enter to accept the current layout tab which is always returned as default:
; or just return "" to accept current layout
3) This is a bit confusing as to what happens when running PLOT sequence in Model vs Layout:
(if (= 1 (getvar 'TILEMODE))
(command "_A")
(command "_N" "_Y")
)
(command "_N" (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME))) "_Y" "_Y")
This should clarify the differences:
(if (= 1 (getvar "tilemode")) ; chk space
(command ; then model
"_A" ; Enter shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual styles/Rendered] <As displayed>:
)
(command ; else layout
"_No" ; Scale lineweights with plot scale? [Yes/No]
"_Yes" ; Plot paper space first? [Yes/No]
"_No" ; Hide paperspace objects? [Yes/No]
)
)
(command
pdfname
"_Yes" ; Save changes to page setup [Yes/No]
"_Yes" ; Proceed with plot [Yes/No]
)
These are the revisions I made for FoxIt with lisp command: PltFox:
; PltFox generates pdf with Foxit.pc3
; OP: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/custom-pc3-not-supported/td-p/13710861
(defun c:PltFox (/ cmdecho ctab filedia pdfname pltare pltctb pltdev pltlwt pltoff pltori pltppr pltscl pltsty pltuni pltupd)
(vl-load-com)
(setq cmdecho (getvar "cmdecho") ; save current settings
filedia (getvar "filedia")
ctab (getvar "ctab")
pdfname (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) "-" ctab ".PDF") ; pdf with layout name appended
)
(setvar "cmdecho" 0) ; suppress command echo
(setvar "filedia" 0) ; suppress file selection window
; begin command line plot sequence
(command "_.-PLOT"
"_Yes" ; Detailed plot configuration? [Yes/No]
ctab ; Enter a layout name or [?] ; or just return "" to accept current layout
"Foxit PDF Editor Printer.pc3" ; Enter an output device name or [?] ; "DWG To PDF.pc3" "Adobe PDF.pc3"
"ARCH D" ; Enter paper size or [?] ; unique for selected printer device
"_Millimeters" ; Enter paper units [Inches/Millimeters] ; "_Inches"
"_Landscape" ; Enter drawing orientation [Portrait/Landscape] ; "_Portrait"
"_No" ; Plot upside down? [Yes/No]
"_E" ; Enter plot area [Display/Extents/Layout/View/Window] "_D" "_L" "_W" "_V"
"_F" ; Enter plot scale (Plotted Inches=Drawing Units) or [Fit] ; "1:1"
"_C" ; Enter plot offset (x,y) <0.00,0.00>: ; "0,0"
"_Yes" ; Plot with plot styles? [Yes/No]
"monochrome.ctb" ; Enter plot style table name or [?] (enter . for none)
"_Yes" ; Plot with lineweights? [Yes/No]
)
(if (= 1 (getvar "tilemode")) ; chk space
(command ; then model
"_A" ; Enter shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual styles/Rendered] <As displayed>:
)
(command ; else layout
"_No" ; Scale lineweights with plot scale? [Yes/No]
"_Yes" ; Plot paper space first? [Yes/No]
"_No" ; Hide paperspace objects? [Yes/No]
)
)
(command
"_Yes" ; Write the plot to a file [Yes/No] ; extra prompt may occur for custom pc3
pdfname
"_Yes" ; Save changes to page setup [Yes/No]
"_Yes" ; Proceed with plot [Yes/No]
)
(setvar "filedia" filedia) ; restore original settings
(setvar "cmdecho" cmdecho)
(princ) ; clean exit
)
1) The line with the printer name entry as you are already aware should now be:
"Foxit PDF Editor Printer.pc3" ; Enter an output device name or [?] ; "DWG To PDF.pc3" "Adobe PDF.pc3"
2) Since this is a different printer there are different named paper sizes so for D size it needs to be entered as:
"ARCH D" ; Enter paper size or [?] ; unique for selected printer device
3) As @Moshe-A mentioned, when using a custom pc3 like FoxIt there is an extra prompt right before entering the plot file name:
(command
"_Yes" ; Write the plot to a file [Yes/No] ; extra prompt may occur for custom pc3
pdfname
"_Yes" ; Save changes to page setup [Yes/No]
"_Yes" ; Proceed with plot [Yes/No]
)
But as I also mentioned in my previous reply to @Moshe-A when running lisp code using a custom pc3 like Foxit, though the pdf file name is given in the code, it will still get interrupted with a plot file name selection window making it not possible to run automatically:
