Jump to content

script for using dwg to pdf, specifying path, but using default file name


vitruvius

Recommended Posts

hello,

 

 

I am currently able to use "dwg to pdf" in a script file to adjust layers in a drawing, etc, and automatically print to pdf where the pdf file name (the dwg file name I am plotting from) and location (same folder that dwg files are in) are set by default.

 

 

I am also able to specify a custom path and file name.

 

 

However, I would like to know if I can specify the path and then allow the pdf name to be the default name, which would be the name of the dwg file. I have not been able to do this in a script.

 

 

Ultimately, I would like to use this script in ScriptPro so that I can direct pdfs to a custom folder, while using the default file name, for a group of drawings.

 

 

thx /v

Link to comment
Share on other sites

You can script plotting pdfs very simply by using a lisp called from thescript this way all the hard stuff is done in the lisp.

 

Open dwg1 (load "plotallpdf") close n

 

I have the following Plot a range of layout tabs and Make a pdf for each layout but combine also all into 1 pdf.

 

You need to download Ghostscript for the combine pdf part.

plotA3Pdfrange2.lsp

GETVALS.lsp

Link to comment
Share on other sites

The idea is that your script is very simple and the lisp does all the work rather than the script.

 

open dwg1 (load "myplottopdf") close n

open dwg2 (load "myplottopdf") close n

Link to comment
Share on other sites

Here is a simpler lisp that will plot all layout tabs. You need to change the plot window values the -6,-6 and 807,560 the 1=2 is for a A3 sheet as our title block is a A1 sheet.

 

; plot layouts to b& w printer
(PROMPT ".....PRINTING DRAWING TO laser printer....")
(setvar "cmddia" 0)
(setvar "filedia" 0)
(setq plotabs nil)
(SETVAR "PDMODE" 0)

(setq dwgname (GETVAR "dwgname"))
(setq lendwg (strlen dwgname))
(setq dwgname (substr dwgname 1 (- lendwg 4)))

(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
 (setq plotabs (cons (vla-get-name lay) plotabs))
)
(setq plottablist (acad_strlsort plotabs))
(setq len (length plottablist))
(setq x 0)
(repeat len
 (setq name (nth x plottablist))
 (princ name)
 (if (/= name "Model")
   (progn
     (setq pdfname (strcat "\\" dwgname "-" (getvar "ctab") ".pdf" ))
    (COMMAND "-PLOT"  "Y"  "" "dwg to Pdf"
       "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" "1=2"  "C"
       "y" "Designlasercolour.ctb" "Y" "n" "n" "n" pdfName "N" "y"
   )
 )
 (setq x (+ x 1))
)
(setvar "cmddia" 1)
(setvar "filedia" 1)
(setq plottablist nil)
(princ)

Link to comment
Share on other sites

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