Jump to content

Recommended Posts

Posted

I have a lisp routine currently that converts the active layout tab of a drawing to a Tiff file and stores it in a very specific location, based on the DWG's filename, on our system. By looking at the code, can anyone suggest an easy way to change it so that it converts an entire list of drawings instead of simply the drawing that is currently open?

 

;-------------------------------------------------------------------------------

;

; tif-con

;

; autocad command to plot and save a tif file using the drawing full pathname

; with the string "map_published" replaced with the string "tif_data"

;

; 20070319.LR initial creation

; 20070323.LR added more page setup and plotter config

; 20100713.LR Edited for sheet orientation

;

;-------------------------------------------------------------------------------

;

(DEFUN C:TIF-CON (/ vbp vfd vfp vpq dp dn pn ct ll pp)

; save system variables

(setq vbp (getvar "backgroundplot"))

(setq vfd (getvar "filedia"))

(setq vfp (getvar "fullplotpath"))

(setq vpq (getvar "plquiet"))

 

; set to no dialog plotting

; backgoundplot has to be a 0 or 2 for foreground plotting

(setvar "backgroundplot" 2)

(setvar "filedia" 0)

(setvar "fullplotpath" 0)

(setvar "plquiet" 1)

; create full path name of tif file based on drawing full path name

(setq dp

(vl-string-subst "tif_data"

"map_published"

(strcase (getvar "dwgprefix") T)

)

)

(setq dn

(strcase (vl-filename-base (getvar "dwgname")) T)

)

(setq pn (strcat dp dn ".tif"))

(setq ct (strcase (getvar "ctab") T))

(while (vl-string-search " " ct)

(setq ct (vl-string-subst "" " " ct)) ;| remove space |;

)

; use layout specific page setup and plotter config

(setq ll

'(("default" "TC-17x22" "tiffconverter-17x22.pc3")

("A-17X22" "TC-17x22" "tiffconverter-17x22.pc3")

("A-17X22L" "TC-17x22L" "tiffconverter-17x22L.pc3")

("B-17x22" "TC-17x22" "tiffconverter-17x22.pc3")

("B-18X24" "TC-18x24" "tiffconverter-18x24.pc3")

("B-18X24L" "TC-18x24L" "tiffconverter-18x24L.pc3")

("detaildwg" "tif-converter" "tiffconverter.pc3")

("gmapdwg" "tif-converter2" "tiffconverter2.pc3")

("C-22X34" "TC-22x34" "tiffconverter-22x34.pc3")

("C-22X34P" "TC-22x34P" "tiffconverter-22x34P.pc3")

("D-36X44" "TC 36x44" "tiffconverter-36x44.pc3")

("D-36X44P" "TC-36x44P" "tiffconverter-36x44P.pc3")

)

)

(if (setq pp (assoc ct ll)) nil (setq pp (car ll)))

(command "-psetupin"

"\\\\nas-cp1b\\data\\mir\\GTS-Miramar\\Gas Mapping\\Mappers\\JBliss\\tifcon\\tif-convert.dwg"

(cadr pp)

""

)

 

(command "-plot"

"n"

(getvar "ctab")

(cadr pp)

(caddr pp)

"y"

(strcat pn ".plt")

"n"

"y"

)

; statements following (command "-plot" ...) will execute before

; plotting is finished, if plotting did not occur in the foreground

; (backgroundplot is 0 or 2)

(if (findfile (strcat pn ".plt"))

(progn

; delete existing tif file, vl-file-rename does not overwrite

(vl-file-delete pn)

(vl-file-rename (strcat pn ".plt") pn)

))

; restore system variables

(setvar "backgroundplot" vbp)

(setvar "filedia" vfd)

(setvar "fullplotpath" vfp)

(setvar "plquiet" vpq)

)

;

 

 

Thank you in advance for your help

Posted

Welcome to the forum,

 

Please use code tags. See here:http://www.cadtutor.net/forum/showthread.php?t=9184

Posted

Sorry about that... first time posting to this forum

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