LISP to batch publish / plot to the folder of the current dwg in pdf

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This *is* a new question as far as I can tell.
I have tried setting autopublish location to .\ but that only works for autopublish, which includes the 2 tabs not to be plotted. I also tried setting default plot location to .\ to no avail.
I am new to lisp, have done a little vba before and diesel, but I can't follow the below.
Annotations on lisp answers to forum posts seem scant on this topic 😞
As an example, this looks good because it doesn't appear to manually override all the plot settings, and it does tab name for "Model" so theoretically can be modified to also check for "Construction"...
Environmental conditions I can think of:
I am running an AutoCAD OEM (latest version, could be 2018 or 2019) (hence the extra ":cadt" in the defun section of below code), but plot commands aren't affected.
I have set up plot layout settings to all layouts which are to be plotted.
I am using monochrome.ctb for pdf plot.
I want to plot A3 PDF in landscape (per plot settings already applied to template).
Plotter is dwg to pdf (for now).
There are 2 tabs in every dwg to NOT plot: "Construction" and "Model". All other tabs are to be plotted.
Destination should be to the exact folder the current dwg is saved in.
The result of this code on my machine is it tries to save a pdf of name "_Y" to the local AutoCAD folder, and it also wants me to save changes to the plot settings. And a pdf viewer is unable to open the result, so presumably it saves without file extension.
TIA for any help!
(defun c:cadt:user06 ( / cm ) ;from https://www.cadtutor.net/forum/topic/50659-pdf-file-saving-location-need-help/page/2/#comments (setq cm (getvar 'CMDECHO)) (setvar 'CMDECHO 0) (command "_.-plot" "_y" (if (= 0 (getvar 'TILEMODE)) "Model" (getvar 'CTAB)) "DWG To PDF.pc3" "ARCH D (36.00 x 24.00 Inches)" "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "monochrome.ctb" "_Y" ) (if (= 1 (getvar 'TILEMODE)) (command "_A") (command "_N" "_Y" "_N") ) (command (strcat (getvar 'DWGPREFIX) "PDF files\\" (vl-filename-base (getvar 'DWGNAME))) "_Y") (setvar 'CMDECHO cm) (princ) ;end web code ) (vl-load-com) (princ) )) )
[Edit]: Attached example DWG.