Jump to content

Recommended Posts

Posted

Hi Everyone, Good day to all,

 

I'm trying to customize a LISP routine to create PDFs using my own .pc3 and ctb file — specifically, I'm using "Foxit PDF Editor Printer.pc3". I tried replacing the default printer and setting a custom paper size, but the code isn’t working as expected.

 

(defun c:PDF ( / cm )
   (setq cm (getvar 'CMDECHO))
   (setvar 'CMDECHO 0)
   (command "_.-plot" "_y"
       (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))
       "AutoCAD PDF (High Quality Print).pc3" "ARCH D (24.00 x 36.00 Inches)"
       "_M" "_L" "_N" "_E" "_F" "_C" "_Y" "monochrome.ctb" "_Y"
   )
   (if (= 1 (getvar 'TILEMODE))
       (command "_A")
       (command "_N" "_Y")
   )
   (command "_N" (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME))) "_Y" "_Y")
   (setvar 'CMDECHO cm)
   (princ)
)
(vl-load-com) (princ)

 

When I replace the default .pc3 file in the LISP code with my own (Foxit PDF Editor Printer.pc3), instead of plotting automatically, it starts asking for every input again — like paper size, plot area, etc

 

Command: PDF
Yes or No, please.
Don't use Esc while using a Lisp commandWrite the plot to a file [Yes/No] <N>: y
Command: MOPRINT
Yes or No, please.
Don't use Esc while using a Lisp commandWrite the plot to a file [Yes/No] <N>:
Save changes to page setup [Yes/No]? <N>
Proceed with plot [Yes/No] <Y>:
Effective plotting area:  903.11 wide by 603.25 high
Plotting viewport 1.
Effective plotting area:  792.73 wide by 577.98 high
Plotting viewport 2.

 

Also, it would be awesome if we could add a feature where each layout gets plotted using a name format and save location pulled from an Excel file. That would seriously save a ton of time and effort. Thanks in advance, friends!

 

 

 

Posted

Did you try to hard code the full path to the .pc3? i.e. C:PathtoPC3folder/Foxit PDF Editor Printer.pc3

  • Funny 1
Posted

No I just entered the name of .pc3. let me try that too. But both custom .pc3 and DWG to pdf .pc3 are located in same folder.

Posted (edited)

For PC3 files, if I remember, I couldn't get LISP to create one so you'll need to set them all up and save the configuration files. It would help if you save them in the default file location

 

A couple of snippets I have,

This gives the default PC3 file location:

 

(defun PC3Loc ( / PCP PC3LOC)
;;Location of custom Print Configuration PC3 files
;;modify if you want a different location from the default AutoCAD location
;;Note standard and no preview PC3 files are to be in the same location for it to work well.
  (setq PC3Loc (vla-get-PrinterConfigPath (vla-get-Files (vla-get-Preferences (vlax-get-acad-object)))))
  PC3LOC
)

 

This one checks that the PC3 file exists - defined in the PC3NAME lisp

 

(defun PC3Name ( / )
;;Name of custom Plot Configuration PC3 File
;;This is the Plot Configutation PC3 file used when you check the 'Preview PDF' checkbox
;;otherwise it uses 'DWG to PDF.pc3'
"DWG to PDF.pc3"
)

(defun PDFgetplottername( pdfpreview / pname)
;;this needs to be set up in pagesetup settings
  (setq pname "DWG to PDF.pc3") ;;Default DWG to PDF plotter

  (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3Name))) )
    (setq pname (PC3Name))
  );;end if


  (if (= pdfpreview "N") ;;get custom PC3 file name
    (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3NameNP))) )
      (setq pname (PC3NameNP))
    );;end if
  );;end if
  pname
)

 

 

where my Dwg to PDF.PC3 is my PDF plotter setting file

Edited by Steven P
  • Agree 1
Posted

@SLW210 I have paste the file path instead paste the "Foxit PDF Editor Printer.pc3". No difference. And also custom.pc3 file were saved in same location as default.

Posted

@Steven P Hi bro, I have tried this and modified but I don't know is this right.

 

(defun PC3Name ( / )
  ;; Name of custom Plot Configuration PC3 File
  ;; This is the Plot Configuration PC3 file used when you check the 'Preview PDF' checkbox
  ;; otherwise it uses 'DWG to PDF.pc3'
  "Foxit PDF Editor Printer.pc3"
)

(defun PC3Loc ( / PCP PC3LOC )
  ;; Location of custom Print Configuration PC3 files
  ;; Note standard and no preview PC3 files are to be in the same location
  (setq PC3Loc
        (vla-get-PrinterConfigPath
          (vla-get-Files
            (vla-get-Preferences
              (vlax-get-acad-object)))))
  PC3LOC
)

(defun PDFgetplottername ( pdfpreview / pname PC3FilePath )
  ;; Get the correct plotter name based on preview or not
  (setq pname "DWG to PDF.pc3") ;; Default fallback

  (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3Name))))
    (setq pname (PC3Name))
  )

  (if (= pdfpreview "N")
    (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3NameNP))))
      (setq pname (PC3NameNP))
    )
  )

  pname
)

(defun PC3Exists (pc3name / fullpath)
  (setq fullpath (strcat (PC3Loc) "\\" pc3name))
  (findfile fullpath)
)

(defun C:PDF1 ( / cm pc3name paperName )
  (vl-load-com)
  (setq cm (getvar 'CMDECHO))
  (setvar 'CMDECHO 0)

  ;; Define your desired PC3 file and paper size
  (setq pc3name "Foxit PDF Editor Printer.pc3")
  (setq paperName "ARCH D") ;; or exact size from your PC3

  ;; Only proceed if the PC3 file exists
  (if (PC3Exists pc3name)
    (progn
      (command "_.-plot" "_y"
        (if (= 1 (getvar 'TILEMODE)) "Model" (getvar 'CTAB))
        pc3name paperName
        "_M" "_L" "_N" "_E" "_F" "_C" "_Y"
        "Free State.ctb" "_Y"
      )
      (if (= 1 (getvar 'TILEMODE))
        (command "_A")
        (command "_N" "_Y")
      )
      (command "_N"
        (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME)) ".pdf")
        "_Y" "_Y"
      )
    )
    (prompt (strcat "\nPC3 file not found: " pc3name))
  )

  (setvar 'CMDECHO cm)
  (princ)
)

 

But after that it shows like 

"Command:  PDF1
PC3 file not found: Foxit PDF Editor Printer.pc3"

 

The custom.pc3 file were saved in same as the default file/location. I don't know what I did wrong.

 

  • Like 1
Posted (edited)

(defun PDFgetplottername ( pdfpreview / pname PC3FilePath ) ;; Get the correct plotter name based on preview or not (setq pname "DWG to PDF.pc3") ;; Default fallback

(defun PDFgetplottername ( pdfpreview / pname PC3FilePath )
  ;; Get the correct plotter name based on preview or not
  (setq pname "DWG to PDF.pc3") ;; Default fallback

 

 

This will need to change as well I think

 

Does PC3Loc return the correct folder? 

Edited by Steven P
Posted (edited)

@Steven P I have tried but it gives same

Quote

Does PC3Loc return the correct folder? 

Yeah it show the correct folder.

Edited by harimaddddy
Posted

Just a maybe, if you have used PLOT then selected a installed windows printer, then opened the custom settings to add sheet sizes etc it should save the pc3 to correct location. Ok the important bit, you should not need the pc3 in the printer name, for Autocad only use "Plot To Pdf".  So for your custom plotter don't have the PC3. Same with sheet size must be an exact match.

 

An example.

(COMMAND "-PLOT"  "Y"  "" "Plot To PDF"
	       "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" "1=2"  "C"
	       "y" "Acad.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
    )

 

Posted

Just quick checking BigAl, I think I use the file extension, .pc3, in my PDF routines, though you might be right and mine works by luck (these were the first LISPs I wrote, so lot of what they do are luck!).

 

 

For OP,  you might need to go through it step by step to see where it isn't working, see what is reported in command line from (PC3Exists pc3name)

Posted

Looking at this one, if I substitute "DWG to PDF.PC3" instead of your Foxit plotter, your PDF1 code will recognise the plotter, so might be an error in the name or if it is saved in the correct location.

 

Does it do anything if you use one of the default CAD PDF writers rather than 3rd party PDF?

Posted
2 minutes ago, Steven P said:

Looking at this one, if I substitute "DWG to PDF.PC3" instead of your Foxit plotter, your PDF1 code will recognise the plotter, so might be an error in the name or if it is saved in the correct location.

 

Does it do anything if you use one of the default CAD PDF writers rather than 3rd party PDF?

I tried that also it doesn't give any difference @Steven P 

Posted

Not sure if this will make any difference, this is a stripped down version of my PDF plotting, - check it works first with a standard PDF plot maybe? then change to what you want.

 

I have a little function for each pdf setting - below they are just values but would be things like client specific stuff, company styles and so on, then these are set to variables which is what most of this is. Look through for 'Change this bit here' as what to change for your PDFs. Note that there are 2 PDF plotters set, I use one to do a plot preview and one that doesn't - you'll need to change both to your Foxit plotter.

 

Anyway, if this works for you it is a basis to do all the other stuff that you might want - just go to each sub function to adjust as you need.

 

 

(defun c:pdfplot ( / ) ;; NOTE: Variables not set

;; Sub functions

  (defun PDFgetdetailedplotconfiguration ( / dpc) (setq dpc "Yes") dpc)
  (defun PDFgetlayoutname ( / lname) (setq lname (getvar "ctab")) lname )

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PC3Name ( / ) "DWG to PDF.pc3" ) ; plotter setting with preview
;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PC3NameNP ( / ) "DWG to PDF no Preview.pc3" ) ; No preview plotter setting
;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PDFgetpapersize ( / ) (setq papersize "ISO expand A0 (841.00 x 1189.00 MM)") )
;;;;;;;;;;;;;;;;;;;;;;


  (defun PDFgetpaperunits ( / pu) (setq pu "") pu)
  (defun PDFGetPageOrientation ( / ) (setq pageorientation "L") pageorientation)
  (defun PDFgetorientation ( / orientation) (setq orientation "landscape") orientation)
  (defun PDFgetplotupsidedown ( / plud) (setq plud "N") plud)

  (defun PDFgetplotarea ( / pla) (setq pla "Extents") pla) ;;Extents, Display, Limits, View
  (defun PDFgetplotscale ( / pls) (setq pls "Fit") pls)
  (defun PDFgetplotoffset ( / plo) (setq plo "Center") plo)
  (defun PDFgetplotwithplotstyles ( / plwpls) (setq plwpls "Y") plwpls)

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PDFgetplotstyletablename ( / plstname) (setq plstname "acad.ctb") plstname)
;;;;;;;;;;;;;;;;;;;;;;

  (defun PDFgetplotwithlineweights ( / plwlw) (setq plwlw "Y") plwlw)
  (defun PDFgetshadeplotsetting ( / spls) (setq spls "As Displayed") spls )
  (defun PDFgetfullpath ( / fp) 
    (if (= (getvar 'dwgtitled) 1)(setq fp (getvar "dwgprefix"))) ;;drawing saved
    (if (= (getvar 'dwgtitled) 0)(setq fp (strcat (PDFgetDesktop) "\\"))) ;;drawing not saved
    fp
  )
  (defun PDFgetDesktop ( / script spFolders desktop) ;;gets the location of the desktop
    (cond (
      (setq script (vlax-create-object "WScript.Shell"))
      (setq spFolders (vlax-get-property script "SpecialFolders")
            desktop   (vlax-invoke-method spFolders 'Item "Desktop")
      )
      (vlax-release-object spFolders)
      (vlax-release-object script)
      ))
    desktop
  )
  (defun PDFgetfilename ( / myfnloc myfn myf) ;; check in here if PDF file to write to is open
    (setq myfnloc (PDFgetfullpath))
    (setq myfn (vl-filename-base (getvar 'dwgname)))
    (setq myf (strcat myfnloc myfn ".pdf"))
    myfn
  )
  (defun PDFgetsaveplotsettings ( / savepls) (setq savepls "N") savepls )
  (defun PDFgetproceedwithplot ( / pwpl) (setq pwpl "Y") pwpl )

  (defun PDFgetplottername ( pdfpreview / pname)

;;;;pname this needs to be set up in pagesetup settings ;;;;
;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
    (setq pname "DWG to PDF.pc3") ;;Default DWG to PDF plotter
;;;;;;;;;;;;;;;;;;;;;;

    (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3Name))) ) (setq pname (PC3Name)) );;end if
    (if (= pdfpreview "N") ;; plotter setting with no preview
      (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3NameNP))) ) (setq pname (PC3NameNP)) );;end if
    );;end if
    pname
  )

;;End of sub functions

  (setq detailedplotconfiguration (PDFgetdetailedplotconfiguration))
  (setq layoutname (PDFgetlayoutname))

  (setq pdfpreview "N")
  (setq plottername (PDFgetplottername pdfpreview))
  (setq papersize (PDFgetpapersize)) ;;drawing paper size...not plotting size if different
  (setq paperunits (PDFgetpaperunits))
  (setq orientation (PDFgetorientation))
  (setq plotupsidedown (PDFgetplotupsidedown))
  (setq plotarea (PDFgetplotarea))
  (setq plotscale (PDFgetplotscale))
  (setq plotoffset (PDFgetplotoffset))
  (setq plotwithplotstyles (PDFgetplotwithplotstyles))
  (setq plotstyletablename (PDFgetplotstyletablename))
  (setq plotwithlineweights (PDFgetplotwithlineweights))
  (setq shadeplotsetting (PDFgetshadeplotsetting))
  (setq fullpath (PDFgetfullpath))
  (setq myfilename (PDFgetfilename))
  (setq filepathname (strcat fullpath myfilename ".pdf"))
  (setq saveplotsettings (PDFgetsaveplotsettings))
  (setq proceedwithplot (PDFgetproceedwithplot))



;; Do plotting
;;Plot model space
  (if (= (getvar "TILEMODE") 1) ;;model space plot
    (progn

      (if (= (ssget "_x" '((410 . "Model"))) nil) ;;check if there are any objects to plot
        (progn
          (alert "-CANCELLING-\nThe drawing is blank")
          (exit)
        ) ; end progn
      ) ; end if

      (if (= plotarea "window")
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea pause pause plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights shadeplotsetting filepathname saveplotsettings proceedwithplot)
      ) ; end if 'window'

      (if (/= plotarea "window")
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights shadeplotsetting filepathname saveplotsettings proceedwithplot)
      ) ; end if

    ) ; end progn
  ) ; end if modelspace

;;Plot paper space
  (if (= (getvar "TILEMODE") 0)
    (progn

      (if (= plotarea "window")
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea pause pause plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights "" "" "" filepathname saveplotsettings proceedwithplot)
      )

      (if (= plotarea "extents")
        (command "zoom" "all" "zoom" ".95x") ;; Zoom screen, just because
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights "" "" "" filepathname saveplotsettings proceedwithplot)
      ) ; end if

    ) ; end progn
  ) ; end if paperspace

  (princ) ; exit quietly
)

 

 

 

 

 

 

  • Thanks 1
Posted
7 minutes ago, Steven P said:

Not sure if this will make any difference, this is a stripped down version of my PDF plotting, - check it works first with a standard PDF plot maybe? then change to what you want.

 

I have a little function for each pdf setting - below they are just values but would be things like client specific stuff, company styles and so on, then these are set to variables which is what most of this is. Look through for 'Change this bit here' as what to change for your PDFs. Note that there are 2 PDF plotters set, I use one to do a plot preview and one that doesn't - you'll need to change both to your Foxit plotter.

 

Anyway, if this works for you it is a basis to do all the other stuff that you might want - just go to each sub function to adjust as you need.

 

 

(defun c:pdfplot ( / ) ;; NOTE: Variables not set

;; Sub functions

  (defun PDFgetdetailedplotconfiguration ( / dpc) (setq dpc "Yes") dpc)
  (defun PDFgetlayoutname ( / lname) (setq lname (getvar "ctab")) lname )

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PC3Name ( / ) "DWG to PDF.pc3" ) ; plotter setting with preview
;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PC3NameNP ( / ) "DWG to PDF no Preview.pc3" ) ; No preview plotter setting
;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PDFgetpapersize ( / ) (setq papersize "ISO expand A0 (841.00 x 1189.00 MM)") )
;;;;;;;;;;;;;;;;;;;;;;


  (defun PDFgetpaperunits ( / pu) (setq pu "") pu)
  (defun PDFGetPageOrientation ( / ) (setq pageorientation "L") pageorientation)
  (defun PDFgetorientation ( / orientation) (setq orientation "landscape") orientation)
  (defun PDFgetplotupsidedown ( / plud) (setq plud "N") plud)

  (defun PDFgetplotarea ( / pla) (setq pla "Extents") pla) ;;Extents, Display, Limits, View
  (defun PDFgetplotscale ( / pls) (setq pls "Fit") pls)
  (defun PDFgetplotoffset ( / plo) (setq plo "Center") plo)
  (defun PDFgetplotwithplotstyles ( / plwpls) (setq plwpls "Y") plwpls)

;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
  (defun PDFgetplotstyletablename ( / plstname) (setq plstname "acad.ctb") plstname)
;;;;;;;;;;;;;;;;;;;;;;

  (defun PDFgetplotwithlineweights ( / plwlw) (setq plwlw "Y") plwlw)
  (defun PDFgetshadeplotsetting ( / spls) (setq spls "As Displayed") spls )
  (defun PDFgetfullpath ( / fp) 
    (if (= (getvar 'dwgtitled) 1)(setq fp (getvar "dwgprefix"))) ;;drawing saved
    (if (= (getvar 'dwgtitled) 0)(setq fp (strcat (PDFgetDesktop) "\\"))) ;;drawing not saved
    fp
  )
  (defun PDFgetDesktop ( / script spFolders desktop) ;;gets the location of the desktop
    (cond (
      (setq script (vlax-create-object "WScript.Shell"))
      (setq spFolders (vlax-get-property script "SpecialFolders")
            desktop   (vlax-invoke-method spFolders 'Item "Desktop")
      )
      (vlax-release-object spFolders)
      (vlax-release-object script)
      ))
    desktop
  )
  (defun PDFgetfilename ( / myfnloc myfn myf) ;; check in here if PDF file to write to is open
    (setq myfnloc (PDFgetfullpath))
    (setq myfn (vl-filename-base (getvar 'dwgname)))
    (setq myf (strcat myfnloc myfn ".pdf"))
    myfn
  )
  (defun PDFgetsaveplotsettings ( / savepls) (setq savepls "N") savepls )
  (defun PDFgetproceedwithplot ( / pwpl) (setq pwpl "Y") pwpl )

  (defun PDFgetplottername ( pdfpreview / pname)

;;;;pname this needs to be set up in pagesetup settings ;;;;
;;;;;;;;;;;;;;;;;;;;;;
;;Change this bit here
    (setq pname "DWG to PDF.pc3") ;;Default DWG to PDF plotter
;;;;;;;;;;;;;;;;;;;;;;

    (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3Name))) ) (setq pname (PC3Name)) );;end if
    (if (= pdfpreview "N") ;; plotter setting with no preview
      (if (findfile (setq PC3FilePath (strcat (PC3Loc) "\\" (PC3NameNP))) ) (setq pname (PC3NameNP)) );;end if
    );;end if
    pname
  )

;;End of sub functions

  (setq detailedplotconfiguration (PDFgetdetailedplotconfiguration))
  (setq layoutname (PDFgetlayoutname))

  (setq pdfpreview "N")
  (setq plottername (PDFgetplottername pdfpreview))
  (setq papersize (PDFgetpapersize)) ;;drawing paper size...not plotting size if different
  (setq paperunits (PDFgetpaperunits))
  (setq orientation (PDFgetorientation))
  (setq plotupsidedown (PDFgetplotupsidedown))
  (setq plotarea (PDFgetplotarea))
  (setq plotscale (PDFgetplotscale))
  (setq plotoffset (PDFgetplotoffset))
  (setq plotwithplotstyles (PDFgetplotwithplotstyles))
  (setq plotstyletablename (PDFgetplotstyletablename))
  (setq plotwithlineweights (PDFgetplotwithlineweights))
  (setq shadeplotsetting (PDFgetshadeplotsetting))
  (setq fullpath (PDFgetfullpath))
  (setq myfilename (PDFgetfilename))
  (setq filepathname (strcat fullpath myfilename ".pdf"))
  (setq saveplotsettings (PDFgetsaveplotsettings))
  (setq proceedwithplot (PDFgetproceedwithplot))



;; Do plotting
;;Plot model space
  (if (= (getvar "TILEMODE") 1) ;;model space plot
    (progn

      (if (= (ssget "_x" '((410 . "Model"))) nil) ;;check if there are any objects to plot
        (progn
          (alert "-CANCELLING-\nThe drawing is blank")
          (exit)
        ) ; end progn
      ) ; end if

      (if (= plotarea "window")
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea pause pause plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights shadeplotsetting filepathname saveplotsettings proceedwithplot)
      ) ; end if 'window'

      (if (/= plotarea "window")
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights shadeplotsetting filepathname saveplotsettings proceedwithplot)
      ) ; end if

    ) ; end progn
  ) ; end if modelspace

;;Plot paper space
  (if (= (getvar "TILEMODE") 0)
    (progn

      (if (= plotarea "window")
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea pause pause plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights "" "" "" filepathname saveplotsettings proceedwithplot)
      )

      (if (= plotarea "extents")
        (command "zoom" "all" "zoom" ".95x") ;; Zoom screen, just because
(command "-plot" detailedplotconfiguration layoutname plottername papersize paperunits orientation plotupsidedown plotarea plotscale plotoffset plotwithplotstyles plotstyletablename plotwithlineweights "" "" "" filepathname saveplotsettings proceedwithplot)
      ) ; end if

    ) ; end progn
  ) ; end if paperspace

  (princ) ; exit quietly
)

 

 

 

 

 

 

@Steven P For sure I'm try this and let you know and thank you so much...

Posted (edited)

Given how long ago the Autopublish mechanism was introduced, I'm surprised it's not being used more. 

 

Autopublish uses the Page Setup you've assigned to Layout, to automagically produce PDF when you save DWG. To plot a full plan set, PUBLISH is frequently used, but it plots the entire set one-at-a-time in series, which takes entirely too long. Autopublish also works in Core Console... which allows you to effectively plot all DWG files at the same time in parallel. 

 

As example:

If it takes 30 seconds to PUBLISH a single-Layout drawing, it takes the same amount of time to plot all drawings in the set, and you have 50 drawings, PUBLISH might take +/-25 minutes to produce PDF. With Core Console it only takes less than 1 minute to plot the same plan set (Note: your workstation's system resources and single vs multi-layout drawings determine how long it takes, multiple single-layout drawings take less time to plot, than fewer multi-layout drawings). 

 

Here's a sample .REG file to create the Windows Shell Menu, so you can plot DWG-->PDF from File Explorer (I use Civil 3D):

  

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf]
@="2026 DWG to PDF"
"AppliesTo"=".dwg"
; "Icon"="C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe"
"HasLUAShield"=""
"Position"="Bottom"

[HKEY_CLASSES_ROOT\*\shell\RightClickDwgToPdf\command]
@="\"C:\\Program Files\\Autodesk\\AutoCAD 2026\\accoreconsole.exe\" /i \"%1\" /ld \"C:\\Program Files\\Autodesk\\AutoCAD 2026\\AecBase.dbx\" /p \"<YourProfileHere>\" /product \"C3D\" /language \"en-US\" /s \"C:\\<YourFilePathHere>\\RightClickDwgToPdf.scr\""

 

 

Here's the dependent Script: 

;; reload layer state, set other sysvars
(setvar 'automaticpub 1)
(command ".QSAVE")

 

That's it; this little bit of code is all that's needed.

 

HTH

Edited by BlackBox

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...