Exchange Forum > AutoLISP and Visual LISP
Dwg to Bmp lisp file?
Dwg to Bmp lisp file?

#1

Koppesetic
Join Date:
02-18-2009
Hi,
Does anyone have a lisp file that converts a dwg to bmp?
Or can you point me to a web site that might?
Thanks for all your help.
Dwg to Bmp lisp file?

#2

Terry Cadd
Join Date:
09-10-2007
Hi Koppesetic,
Give this little lisp a try. Do a zoom extents or zoom in on a detail. It captures the image of the current view.
Regards,
Terry
Code:
(defun c:BMP (/ FilePath$)
  (setq FilePath$ (strcat (getvar "DWGPREFIX")
    (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) "_"
    (getvar "CTAB") ".bmp")
  );setq
  (command "_EXPORT" FilePath$ "")
  (princ (strcat "\n" FilePath$ " created."))
  (princ)
);defun c:BMP
Dwg to Bmp lisp file?

#3

Koppesetic
Join Date:
02-18-2009
Terry,
This is great! How can I run this on a whole directory of dwgs???
Koppesetic
Dwg to Bmp lisp file?

#4

Terry Cadd
Join Date:
09-10-2007
Try using my Script Creator program SCRS, put (c:BMP) on one line by itself.
And go...
Regards,
Terry
http://web2.airmail.net/terrycad/LISP/Scrs.lsp
http://web2.airmail.net/terrycad/LISP/Scrs.dcl
Dwg to Bmp lisp file?

#5

Koppesetic
Join Date:
02-18-2009
How do I get it to capture all the tab layouts?
Dwg to Bmp lisp file?

#6

Terry Cadd
Join Date:
09-10-2007
Somehow I knew you were going to ask that. Well just have it cycle through the tabs.
Here's a version that does just that.
Terry
Code:
;-------------------------------------------------------------------------------
; c:BMPtabs - Creates bmp files for each tab layout in a drawing
;-------------------------------------------------------------------------------
(defun c:BMPtabs (/ FilePath$ Layout$)
  (foreach Layout$ (GetLayoutList)
    (command "LAYOUT" "S" Layout$)
    (command "PSPACE")
    (command "ZOOM" "E")
    (setq FilePath$ (strcat (getvar "DWGPREFIX")
      (substr (getvar "DWGNAME") 1 (- (strlen (getvar "DWGNAME")) 4)) "_"
      (getvar "CTAB") ".bmp")
    );setq
    (command "_EXPORT" FilePath$ "")
    (princ (strcat "\n" FilePath$ " created."))
  );foreach
  (command "LAYOUT" "S" (nth 0 (GetLayoutList)))
  (princ)
);defun c:BMPtabs
;-------------------------------------------------------------------------------
; GetLayoutList - Returns a list of layouts in the drawing in tab order
;-------------------------------------------------------------------------------
(defun GetLayoutList (/ Layouts@)
  (vlax-map-collection (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object)))
    '(lambda (x) (setq Layouts@ (cons x Layouts@)))
  );vlax-map-collection
  (setq Layouts@ (vl-sort Layouts@ '(lambda (x y) (< (vla-get-taborder x) (vla-get-taborder y)))))
  (vl-remove "Model" (mapcar '(lambda (x) (vla-get-name x)) Layouts@))
);defun GetLayoutList
;-------------------------------------------------------------------------------
(princ)
Dwg to Bmp lisp file?

#7

Koppesetic
Join Date:
02-18-2009
That’s incredible... That lisp file saved me a lot of time!
 
Thanks Terry!