Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export layouts as individual drawings

2 REPLIES 2
Reply
Message 1 of 3
Timo Huttunen
494 Views, 2 Replies

Export layouts as individual drawings

Does any one know of a routine that will save out a seperate drawing file for each layout in a drawing file?

Thanks
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Timo Huttunen

like 2 years ago I find the file layoutsTodwg.lsp, thanks to Jimmy Bermark
this is the lisp, you know what to do next.

Elvis

;;;
;;; LayoutsToDwgs.lsp
;;; Created 2000-03-27

;;; By Jimmy Bergmark
;;; Copyright (C) 1997-2003 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com
;;; E-mail: info@jtbworld.com
;;;
;;; 2003-12-12 Sets UCS to world in model space to avoid problem with wblock
;;;

;;; For AutoCAD 2000, 2000i, 2002, 2004
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Creates drawings of all layouts.
;;; Only one layout at a time is saved, the rest are deleted.
;;; This is handy when you want to save to pre A2k versions.
;;; The new drawings are saved to the current drawings path
;;; and overwrites existing drawings.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:LayoutsToDwgs (/ fn path msg msg2 fileprefix)
(defun DelAllLayouts (Keeper / TabName)
(vlax-for Layout
(vla-get-Layouts
(vla-get-activedocument (vlax-get-acad-object))
)
(if
(and
(/= (setq TabName (strcase (vla-get-name layout))) "MODEL")
(/= TabName (strcase Keeper))
)
(vla-delete layout)
)
)
)

(vl-load-com)
(setq msg "")
(setq msg2 "")
(command "._undo" "_BE")
(setq fileprefix (getstring "Enter filename prefix: "))
(foreach lay (layoutlist)
(if (/= lay "Model")
(progn
(command "_.undo" "_M")
(DelAllLayouts lay)
(setvar "tilemode" 1)
(command "ucs" "w")
(setvar "tilemode" 0)
(setq path (getvar "DWGPREFIX"))
(setq fn (strcat path fileprefix lay ".dwg"))
(if (findfile fn)
(progn
(command ".-wblock" fn "_Y")
(if (equal 1 (logand 1 (getvar "cmdactive")))
(progn
(setq msg (strcat msg "\n" fn))
(command "*")
)
(setq msg2 (strcat msg2 "\n" fn))
)
)
(progn
(command ".-wblock" fn "*")
(setq msg (strcat msg "\n" fn))
)
)
(command "_.undo" "_B")
)
)
)
(if (/= msg "")
(progn
(prompt "\nFollowing drawings were created:")
(prompt msg)
)
)
(if (/= msg2 "")
(progn
(prompt "\nFollowing drawings were NOT created:")
(prompt msg2)
)
)
(command "._undo" "_E")
(textscr)
(princ)
)


wrote in message news:4919398@discussion.autodesk.com...
Does any one know of a routine that will save out a seperate drawing file
for each layout in a drawing file?

Thanks
Message 3 of 3
a.gnodde
in reply to: Anonymous

Thanks for sharing this Lisp script. It is really helpfull to me.

 

 

regards, Albert.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost