Hello all, I've got the following subfunction defined in order to quickly create a pdf of the current drawing.
I'd like to have this run automatically, creating a pdf in the directory in which the drawing resides within windows.
I would like to save the pdf as the drawing filename, but I am having trouble feeding this parameter automatically.
Please take a look at my snippet
(defun CreatePlot( / filename) (setq filename (strcat (getvar "DWGPREFIX") (vl-filename-base (getvar "DWGNAME")) ".pdf")) (command "_.PLOT" "YES" "MODEL" "PDF-XChange for AcroPlot Pro" "Tabloid/ANSI B" "I" "L" "N" "Extents" "F" "C" "Y" "monochrome.ctb" "Y" "As Displayed" "N" ; filename "N" "Y" );plot );defun
But even with this iteration and the previous ones I am able to have the pdf created automatically, but it still brings up the dialog that asks for a save name and location. I would like to bypass this dialog and have the pdf saved as the drawing name, using (strcat (getvar "dwgprefix")(getvar "dwgtitle")) or some combination of that. I don't know if that's precise in my example but I know it's a common method---i'm just needing to know how to give that information to the save dialog in order to suppress the dialog and allowing my routine to create the pdf silently and with no additional user input.
Please help, and thanks in advance!!
Solved! Go to Solution.
Solved by p_mcknight. Go to Solution.
Hi Brandon,
with the "PDF-XChange for AcroPlot Pro" plotter, I don't know (I don't have that plotter), but with the "DWG TO PDF.PC3" plotter can be done...
As a demo, take a look at http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Macro-for-8x11-PDF-quick-plot-button/...
HTH
Henrique
Okay, I'll give it a try.
Thanks Henrique!
Yeah, not quite...
still getting this dialog that would prevent any sort of batch processing that i'm hoping to be able to accomplish.
Yeah, Filedia is set to 0.
Cmddia is the same
Is there a reason you are avoiding the dwg to pdf plotter? I believe with some 3rd party pdf creators you cannot suppress the dialog box as they are part of the separate program. Have you tried your routine with the built-in pdf creator?
@bhull1985 wrote:
Yeah, not quite...
still getting this dialog that would prevent any sort of batch processing that i'm hoping to be able to accomplish.
Brandon,
change the ctb file to one you have in your system, and the code will pause for pick the plot window, is just a demo, and you don´t have the save dialog...
(defun c:test (/ fl) (setq fl (strcat (getvar "dwgprefix") (getvar "dwgname"))) (setq fl (strcat (vl-string-right-trim ".dwg" fl) "-" (getvar "ctab") ".pdf")) (if (findfile fl) (command "-PLOT" "Y" "" "DWG TO PDF.PC3" "ANSI A (8.50 X 11.00 INCHES)" "I" "P" "N" "W" pause pause "" "C" "Y" "Henrique.CTB" "Y" "" "" "Y" "" "") (command "-PLOT" "Y" "" "DWG TO PDF.PC3" "ANSI A (8.50 X 11.00 INCHES)" "I" "P" "N" "W" pause pause "" "C" "Y" "Henrique.CTB" "Y" "" "" "" "") );if (princ) )
HTH
henrique
I did
this is the plot command that I ran, that ended with the save dialog
(command "-PLOT" "Y" "" "DWG TO PDF.PC3" "Tabloid/ANSI B" "I" "L" "N"
"Extents" "F" "C" "Y" "MONOCHROME.CTB" "Y" "" "" "Y" "" "")
Your code has to give it a location
(command "-plot" "yes" "model" "DWG To PDF" "ANSI A (8.50 x 11.00 Inches)" "inches" "landscape" "no" "window" lowerLeft upperRight "fit" "center" "yes" "serpa-cwv.ctb" "yes" "as displayed" (newFileType "pdf") "no" "yes")
In the above code (newFileType "pdf") gives it a filepath and name.
Okay, I'll try it using
(setq fl (strcat (getvar "dwgprefix") (getvar "dwgname")))
(setq fl (strcat (vl-string-right-trim ".dwg" fl) "-" (getvar "ctab") ".pdf"))
(command ".-PLOT" "Y" "" "DWG TO PDF.PC3" "" "I" "L" "N" "Extents" "F" "C" "Y" "MONOCHROME.CTB" "Y" "" fl "N" "Y")
Alright! And yes, it worked without bringing up the save pdf dialog.
Thanks guys!