Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Quick Plot Help - suppress save as dialog

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
bhull1985
812 Views, 12 Replies

Quick Plot Help - suppress save as dialog

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!!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
12 REPLIES 12
Message 2 of 13
hmsilva
in reply to: bhull1985

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

EESignature

Message 3 of 13
bhull1985
in reply to: hmsilva

Okay, I'll give it a try.
Thanks Henrique!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 4 of 13
hmsilva
in reply to: bhull1985

You're welcome, Brandon

Henrique

EESignature

Message 5 of 13
bhull1985
in reply to: hmsilva

dia.jpgYeah, not quite...

still getting this dialog that would prevent any sort of batch processing that i'm hoping to be able to accomplish.

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 6 of 13
p_mcknight
in reply to: bhull1985

Have you set filedia to 0?

Message 7 of 13
bhull1985
in reply to: p_mcknight

Yeah, Filedia is set to 0.

Cmddia is the same

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 8 of 13
p_mcknight
in reply to: bhull1985

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?

Message 9 of 13
hmsilva
in reply to: bhull1985


@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

EESignature

Message 10 of 13
bhull1985
in reply to: hmsilva

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" "" "")

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 11 of 13
p_mcknight
in reply to: bhull1985

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.

Message 12 of 13
bhull1985
in reply to: p_mcknight

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!

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 13 of 13
m_rogoff
in reply to: bhull1985

see attached "Capture.Jpeg"

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost