How to set the default plot location as the .dwg location when printing to PDF

How to set the default plot location as the .dwg location when printing to PDF

guilherme.lepinski.sc
Enthusiast Enthusiast
6,908 Views
21 Replies
Message 1 of 22

How to set the default plot location as the .dwg location when printing to PDF

guilherme.lepinski.sc
Enthusiast
Enthusiast

I recently installed Autocad 2025, before that i didn't have to define a default folder where the plotted .pdf will go.

 

This link doesn't help me, as it considers that I always define a default folder where the .pdf file will go.

 

I don't see any option to at least ask me where autocad should put the pdf file when I print.

 

This is OPTIONS > Plot and Publish:

WhatsApp Image 2024-06-19 at 14.36.22.jpeg

It always goes to that same folder.

 

Also:

 

guilhermelepinskisc_0-1718819004714.png

 

guilhermelepinskisc_1-1718819009980.png

why does autocad keep generating this plot file, even with the option deactivated?

0 Likes
Accepted solutions (1)
6,909 Views
21 Replies
Replies (21)
Message 2 of 22

atGK8NU
Advocate
Advocate
Accepted solution
Message 3 of 22

pendean
Community Legend
Community Legend

Do this...

 

pendean_0-1718820329240.png

 

Message 4 of 22

changmarin
Enthusiast
Enthusiast

WhatsApp Image 2024-06-19 at 14.36.22.jpeg

Ch.-
0 Likes
Message 5 of 22

paullimapa
Mentor
Mentor

It should not continue to automatically save a pdf when you have that option unchecked. First make sure you’ve installed the latest 2025 update. If problem persists open a support ticket with Autodesk

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 22

guilherme.lepinski.sc
Enthusiast
Enthusiast

I chose to use AUTOPUBLISH, for now...

 

I don't know why my autocad is behaving this way, when I have more time available I will go back to the previous version I was using (2021).

 

Thank you very much!

0 Likes
Message 7 of 22

quentin_riethmuller
Participant
Participant

Thanks Pendean,

The lisp worked once when I opened a drawing from folder “A” but when I opened a drawing from folder “B”, the pdf wanted to plot back to folder “A”. Reloading the LISP didnt work either.

So the LISP works once but i have to reboot ACAD for it to work again.

Any ideas. 

0 Likes
Message 8 of 22

paullimapa
Mentor
Mentor

Odd because it works for me. 

As long as you save acaddoc.lsp in one of the folders listed under Options>Files>Support File Search Path & Trusted Locations

acaddoc.lsp runs automatically each time a dwg is opened setting the PlotToFilePath to the current opened drawing's path

Attached is the single line of code that's needed inside acaddoc.lsp for this to work:

(command "_.PlotToFilePath" (getvar"dwgprefix"))

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 9 of 22

quentin_riethmuller
Participant
Participant

the original lisp you gave me didnt have the _. before Plot ToFilePath.......would that make a difference?

 

(command "PlotToFilePath" (getvar "DWGPREFIX")).......what you gave me

0 Likes
Message 10 of 22

paullimapa
Mentor
Mentor

It should not make a difference.

The "_" underscore tells AutoCAD to use the native language command which is English.

The "." period tells AutoCAD to execute the command incase it was Undefined.

You'll know if the lisp code ran successfully after you opened the drawing by entering the following at the command prompt:
PlotToFilePath

If the code executed, AutoCAD will include in the return prompt with your current drawing's path


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 11 of 22

quentin_riethmuller
Participant
Participant

sorry Paul, i've saved the lisp file to the locations you said and added the location in the Options>Files>Support File Search Path Trusted Locations but it still reverts back to the original drawing folder when printing.

only way it works for me is if i reboot ACAD - works fine until i open a drawing in another folder. 

the (getvar "DWGPREFIX") doesnt seem to be kicking in....

 

0 Likes
Message 12 of 22

paullimapa
Mentor
Mentor

And what happens when you do this as I requested in my last reply? 

You'll know if the lisp code ran successfully after you opened the drawing by entering the following at the command prompt:
PlotToFilePath

If the code executed, AutoCAD will include in the return prompt with your current drawing's path


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 13 of 22

quentin_riethmuller
Participant
Participant

Hi Paul, yes i ran the PlotToFilePath command and the path was correct for the drawing i had just printed. i have also tried manually running the lisp file when i change to another folder location but that didnt work either - it still wants to save the pdf file in the original (first) folder.

0 Likes
Message 14 of 22

paullimapa
Mentor
Mentor

@quentin_riethmuller 

(command "PlotToFilePath" (getvar "DWGPREFIX")) lisp is currently designed to retrieve the current drawing folder location as the plot path.

If you want to set a different location than the current drawings path, then this is not the lisp code to use to set this.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 15 of 22

quentin_riethmuller
Participant
Participant

the PlotToFilePath is correct, but when i go to actually plot the file, it reverts to the original path.....is this a lisp issue or a plotter issue? the plotter i use is DWG to PDF - PDF ePlot-by Autodesk 

quentin_riethmuller_0-1753654674830.png

 

0 Likes
Message 16 of 22

paullimapa
Mentor
Mentor

Looks like AutoCAD only reads the PlotToFilePath when the program first opens.

Thereafter if you select a different folder to generate the Plot file, AutoCAD will then remember that last selected folder on the next Plot to file command sequence. The way to get around that would be to run a lisp function to generate the Plot using the current drawing path as the location to save the pdf.

Note, only the built-in AutoCAD pdf pc3 devices like Dwg To Pdf.pc3 works when implementing this using lisp.

Review the discussion in this recent thread:

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/turning-off-last-plotted-folder-so-d...


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 17 of 22

quentin_riethmuller
Participant
Participant

so if i replace your PPATH routine with the PLOTME routine from that post (and edit some entries) and resave the acaddoc.lsp, that should work?

quentin_riethmuller_0-1753662248787.png

 

0 Likes
Message 18 of 22

paullimapa
Mentor
Mentor

If the following plot settings are always the same then you can load PlotMe.lsp (revised attached) at startup and it'll always be available to run:

paper size = ISO full bleed A3 (420.00 x 297.00 MM), plot area = Extents; Scale = 1=1, plot style table = acad.ctb

Otherwise you may end up having different versions saved with a different lisp file name which you can then load them all at startup.

; PlotMe generates pdf with DWG To PDF.pc3
; OP: https://forums.autodesk.com/t5/autocad-forum/how-to-set-the-default-plot-location-as-the-dwg-location-when/m-p/13742012#M352292
(defun c:PlotMe (/ 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 
        pdfname (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".PDF") ; pdf name
  )
  (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      
    "DWG To PDF.pc3" ; Enter an output device name or [?] ; "AutoCAD PDF (High Quality Print).pc3" "AutoCAD PDF (General Documentation).pc3" "AutoCAD PDF (High Quality Print).pc3" "AutoCAD PDF (Smallest File).pc3" "AutoCAD PDF (Web and Mobile).pc3"
    "ISO full bleed A3 (420.00 x 297.00 MM)" ; 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"
    "1=1" ; Enter plot scale (Plotted Inches=Drawing Units) or [Fit] ; "1:1"
    "0,0" ; Enter plot offset (x,y) <0.00,0.00>: ; "0,0" 
    "_Yes" ; Plot with plot styles? [Yes/No]
    "acad.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]
    "_No" ; 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
)

Note: lines beginning with a semicolon ";" in the lisp code is not executed. 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 19 of 22

quentin_riethmuller
Participant
Participant

hi paul,

the good news is that it works, the other news is that it only works when i put in the command PLOTME to run the lisp program. It doesnt work when i plot from the plot icon

quentin_riethmuller_0-1753671185103.png

is this a seperate issue and is it an easy fix?

0 Likes
Message 20 of 22

paullimapa
Mentor
Mentor

That toolbar is standard toolbar setup with PLOT icon using the standard PLOT command.

You'll have to customize the toolbar and either modify the existing PLOT command to PLOTME or add a new icon that tells AutoCAD to use PLOTME command instead.

Here's one video tutorial I found on line that shows you how to add custom toolbars:

https://www.youtube.com/watch?v=e0kza0yil0M&t=153s

You can look for others on-line as well.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes