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

Default folder -plot macro

4 REPLIES 4
Reply
Message 1 of 5
sander.van.pelt
239 Views, 4 Replies

Default folder -plot macro

Hello everybody,

 

For quick printing of layouts I want to create a ribbon panel with different buttons with macros for printing an active layout with a certain page setup (pdf).
These multiple page setups are loaded automatically.

 

By default, when I run the -plot command, I get the "create plot file" window where I can select in which folder I want to save the pdf.

How can I select a default folder in which to save this pdf and not see this window again when I use the -plot command, via my panel.


For example, that "C:\user\desktop\pdf" is the default folder where my pdf drawings that I print this way are stored.

Thank you for your support

Labels (3)
4 REPLIES 4
Message 2 of 5
pendean
in reply to: sander.van.pelt

Have you had a chance to explore what's already been created yet?
https://www.google.com/search?q=autocad+lisp+tip%3A+plot+pdf+to+a+specific+folder
Message 3 of 5
Sea-Haven
in reply to: sander.van.pelt

This makes a pdf directory under the dwg directory

 

; check that pdf directory exists
(setq dwgpre (strcat (getvar "dwgprefix") "\pdf"))
(if (= (vl-file-directory-p dwgpre) nil)
(vl-mkdir dwgpre)
)

 

 

So can use (strcat dwgpre filename) for pdf name.

 

(setq pdfname (strcat dwgpre "\\" dwgname "-" (getvar "ctab") ".pdf" ))
Message 4 of 5
sander.van.pelt
in reply to: pendean

Hello Pendean,

Thank you for your reply frist.

I found a lisp, from @hmsilva , from this post "https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-pdf-export/m-p/3807607#M309823".

With the help of this lisp I can print all layouts in one go to PDF. They also get the name of only the layouts themselves, which is what I want, and not "drawing-name"-"layout-name".pdf, but then they will all be printed with the same paper sizes and placed on my desktop.
A location that I want to change to the same location as my "default location for plot to file operations".

If I change this lisp (with my barely lisp knowledge), so that it only prints 1 layout instead of all layouts, my active layout jumps shortly to another layout first, prints it, and jumps back to my active layout.

For example, the drawing where I test this 1 layout plot lisp has 6 layouts. If layout2 is active then layout5 will be printed.


What is the reason why it jumps to a different layout for a short time.
And how do I change the read only "dwgprefix" location to my "plot to file" folder.

(defun C:printall (/ layouts num)
  (setq layouts (layoutlist)); list all paperspace layouts in the drawing
  (setq num 0); zero counter
  (repeat (length layouts); Repeats the plot command on all layouts
    (command ".-PLOT"
	     "Y" ;; Detailed plot configuration? [Yes/No] <No>: y
	     (nth num layouts) ;;Enter a layout name or [?] <Test_001>:
	     "DWG To PDF.pc3" ;;Enter an output device name or [?] <DWG To PDF.pc3>:
	     "iso a1 (594.00 x 841.00 mm)" ;;Enter paper size or [?] <iso a1 (594.00 x 841.00 mm)>:
	     "Millimeters" ;;Enter paper units [Inches/Millimeters] <Millimeters>:
	     "Landscape" ;;Enter drawing orientation [Portrait/Landscape] <Landscape>:
	     "No" ;;Plot upside down? [Yes/No] <No>:
	     "Layout" ;;Enter plot area [Display/Extents/Layout/View/Window] <Layout>:
	     "1:1" ;;Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <1:1>:
	     "0.00,0.0" ;;Enter plot offset (x,y) <0.00,0.00>:
	     "Yes" ;;Plot with plot styles? [Yes/No] <Yes>:
	     "kleur.ctb" ;;Enter plot style table name or [?] (enter . for none) <kleur.ctb>:
	     "Yes" ;;Plot with lineweights? [Yes/No] <Yes>:
	     "Yes" ;;Scale lineweights with plot scale? [Yes/No] <No>: y
	     "Yes" ;;Plot paper space first? [Yes/No] <No>:
	     "No" ;;Hide paperspace objects? [Yes/No] <No>:
	     (strcat (getvar "DWGPREFIX") (getvar "CTAB") ".pdf") ;; the pdf file with the layout name
	     "No" ;;Save changes to page setup [Yes/No]? <N>
	     "Yes" ;;Proceed with plot [Yes/No] <Y>:
    );; end .-plot
    (setq num (1+ num)); Increment counter
  ); end repeat
); end function

****************************************************************
(defun C:printA1 (/ layouts num)
  (setq layouts (layoutlist)); list all paperspace layouts in the drawing
  (setq num 0); zero counter
    (command ".-PLOT"
	     "Y" ;; Detailed plot configuration? [Yes/No] <No>: y
	     (nth num layouts) ;;Enter a layout name or [?] <Test_001>:
	     "DWG To PDF.pc3" ;;Enter an output device name or [?] <DWG To PDF.pc3>:
	     "iso a1 (594.00 x 841.00 mm)" ;;Enter paper size or [?] <iso a1 (594.00 x 841.00 mm)>:
	     "Millimeters" ;;Enter paper units [Inches/Millimeters] <Millimeters>:
	     "Landscape" ;;Enter drawing orientation [Portrait/Landscape] <Landscape>:
	     "No" ;;Plot upside down? [Yes/No] <No>:
	     "Layout" ;;Enter plot area [Display/Extents/Layout/View/Window] <Layout>:
	     "1:1" ;;Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <1:1>:
	     "0.00,0.0" ;;Enter plot offset (x,y) <0.00,0.00>:
	     "Yes" ;;Plot with plot styles? [Yes/No] <Yes>:
	     "kleur.ctb" ;;Enter plot style table name or [?] (enter . for none) <kleur.ctb>:
	     "Yes" ;;Plot with lineweights? [Yes/No] <Yes>:
	     "Yes" ;;Scale lineweights with plot scale? [Yes/No] <No>: y
	     "Yes" ;;Plot paper space first? [Yes/No] <No>:
	     "No" ;;Hide paperspace objects? [Yes/No] <No>:
	     (strcat (getvar "DWGPREFIX") (getvar "CTAB") ".pdf") ;; the pdf file with the layout name
	     "No" ;;Save changes to page setup [Yes/No]? <N>
	     "Yes" ;;Proceed with plot [Yes/No] <Y>:
    );; end .-plot
    (setq num (1+ num)); Increment counter
); end function

 

Message 5 of 5
Sea-Haven
in reply to: sander.van.pelt

For all layouts you can use (layoutlist) to get a list of layouts then use (foreach and (setvar 'ctab layoutname) to go to each layout and plot.

 

This example allows plot range of layouts 1, 3-5, all etc. You will need to edit to suit your dwg title block and destination.

SeaHaven_0-1691022186654.png

 

 

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report