Jump to content

Dwg to pdf


naren
 Share

Recommended Posts

hi guys,

 

I have found a desired lisp routine to convert DWG TO PDF after long googling and made little changes to suit my requirement. Here problem is this routine converts each DWG at a time but I have to convert around 100 dwgs to pdf. somebody can help me to convert this routine to proceed as batch converter:(.

Link to comment
Share on other sites

sorry forgot routine

 

(defun c:A3_BIGENCOLOUR_PDF (/)

(setvar "cmdecho" 0)

 

(setq cur_plottransparencyoverride (getvar "PLOTTRANSPARENCYOVERRIDE"))

(setvar "PLOTTRANSPARENCYOVERRIDE" 2)

 

 

(setq cur_space (getvar "ctab"))

 

(

(command "zoom" "Extents")

(setq filename (getfiled "Enter PDF file name" "" "pdf" 1)) ;;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/plot-pdf-lisp/td-p/3060536

(command "-plot" ; Start plot command

"yes" ; Detailed plot configuration?

(getvar "ctab") ; Get a layout name

"DWG To PDF.pc3" ; Enter an output device name GEBRUIK DUBBEL \\ VIR UNC PARTHS

"ISO full bleed A3 (420.00 x 297.00 MM)" ; Enter paper size

"Millimeters" ; Enter paper units

"Landscape" ; Enter drawing orientation

"No" ; Plot upside down?

"window" ; Enter plot area

"1:1" ; Enter plot scale

"Center" ; Enter plot offset (x,y)

"Yes" ; Plot with plot styles?

"prop.ctb" ; Enter plot style table name or

"No" ; Plot with lineweights?

"No" ; Scale lineweights with plot scale?

"No" ; Plot paper space first?

"No" ; Hide paperspace objects?

filename

;;; "No" ; Write the plot to a file

"Yes" ; Save changes to page setup

"Yes" ; Proceed with plot

))

 

(setvar "cmdecho" 1)

(setvar "PLOTTRANSPARENCYOVERRIDE" cur_plottransparencyoverride)

(princ)

 

(princ)

)

Link to comment
Share on other sites

I have Page Setups for both PDF or Plotter in every Layout for all my Templates. When needed I'll toggle Page Setups for all layouts at between PDF and Plotter with a lisp routine.

To plot a single layout I have a macro in my Ribbon

^C^C-Plot;No;;;;No;No;Yes

that sends it to the plotter with one click.

 

With a structured approach AutoCAD is easy. Are you seriously still picking window corners every time you plot?

Link to comment
Share on other sites

sunny,

I know publishing but instead of publish I want to use routine.

 

I don't see any better way then using PUBLISH for this. Since you want the drawings to plot to PDF. PUBLISH is perfect for that (has an checkbox to override the plotter set in the layout)

Link to comment
Share on other sites

Hi i use this lisp

 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                               ;
;                          Layouts To PDF                      ;
;                                                               ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun C:laytopdf ( / cmd )
 (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0)
 (foreach Layout (layoutlist)

   (command "_.-PLOT" 
     "No"                                        ; Detailed plot configuration? [Yes/No] <No>: No
     Layout                                      ; Enter a layout name or [?] <Layout1>:
     ""                                          ; Enter a page setup name
     "DWG To PDF.pc3"                            ; Enter an output device name or [?] <DWG To PDF.pc3>:
     (strcat (getvar "DWGPREFIX") Layout ".pdf") ; Directory to save
     "No"                                        ; save changes to page setup?
     "YES"                                       ; proceed with plot?
   ); command
 ); foreach
 (vla-put-StyleSheet(vla-get-ActiveLayout (vla-get-ActiveDocument (vlax-get-acad-object))) "monochrome.stb" )
 (setvar 'cmdecho cmd)
 (princ)
); defun C:test

Link to comment
Share on other sites

I don't see any better way then using PUBLISH for this. Since you want the drawings to plot to PDF. PUBLISH is perfect for that (has an checkbox to override the plotter set in the layout)

There are reasons for wanting to do this as as lisp.

For example if you have a very particular set of setting for plotting and you would like users just to press one button speeding up the printing process and reducing miss prints

Link to comment
Share on other sites

If you want to do a 100 dwgs and each drawing has multiple layouts not a problem also, you only have to look at the lisp code and what function is being called to run it, then use a script

 

open dwg1 (load "myplot")(c:laytopdf) close n

open dwg2 (load "myplot")(c:laytopdf) close n

 

A better way is to auto load the plot routine then it does not need to be loaded each time.

 

The other extra I do is plot a pdf for each layout but at the end combine all of them into 1 using Ghostscript.

 

Like others here I use a hard coded area setting that suits our dwg's.

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

 Share

×
×
  • Create New...