Jump to content

Recommended Posts

Posted

Hello

looking for a lisp to export each layout to a dwg drawing separately without open each file . im working on 3D and the layout contains the VIEWBASE projections.

now im using the command EXPORTLAYOUT but it takes too much time , beacuse i have to open each drawing ..

 

Thanks

Posted
Searching led to no results ?

unfortunately nope

Posted

To clarify, you are looking to create an individual drawing from each paper space layout in a selected number of original drawings.

Drawing 1 has 12 layouts

2 has 8 layouts

Total new drawings created = 20

Posted

I am not sure that you could do this without opening the drawing, but you could automate the process with a batch file to open the drawing then start a lisp to perform the exportlayout function.

Posted (edited)

Or do a script the current layout can be set easily by (setvar "Ctab" "layoutname")

 

Open dwg1 
(setvar "Ctab" "layoutname1") exportlayout .......
(setvar "Ctab" "layoutname2") exportlayout .......
(setvar "Ctab" "layoutname3") exportlayout .......
close N

version 2

open dwg1 (load "exportlayouts") close N
open dwg2 (load "exportlayouts") close N
open dwg3 (load "exportlayouts") close N

 

; not tested exportlayouts.lsp
(defun AH:layoutout ( / doc plotab lay layoutname)
(vl-load-com)
(setvar "filedia" 0)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
(setq plotab (vla-get-name lay) plotabs)) ; the plotab needs a directory to be  added for export 
(setvar "ctab" plotab)
(setq layoutname (strcat (getvar "dwgprefix") (getvar "dwgname") "-" plotab))
(command "exportlayout" layoutname)
)
(princ)
)
(AH:layoutout)

Edited by BIGAL
Posted
Or do a script the current layout can be set easily by (setvar "Ctab" "layoutname")

 

 

 

; not tested exportlayouts.lsp
(defun AH:layoutout ( / doc plotab lay layoutname)
(vl-load-com)
(setvar "filedia" 0)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vlax-for lay (vla-get-Layouts doc)
(setq plotab (vla-get-name lay) plotabs)) ; the plotab needs a directory to be  added for export 
(setvar "ctab" plotab)
(setq layoutname (strcat (getvar "dwgprefix") (getvar "dwgname") "-" plotab))
(command "exportlayout" layoutname)
)
(princ)
)
(AH:layoutout)

 

lisp isnt working for me ..

i already have a lisp that export layout in open drawing , but im looking for something that does it in a batch for a whole folder for any layout exist .

;;;   export all Layouts   
(prompt "\n Written by: Amir Hossein Sattarian ")
(prompt "(+98)9126049289 ahsattarian2@gmail.com ")
(prompt "\n Type : LXA ")
(defun c:lxa ()
 (setq layouts (layoutlist))
 (setq layouts (acad_strlsort layouts))
 (setq ad (getvar "dwgprefix"))
 (setq layfol (strcat ad "Layouts"))
 (vl-mkdir layfol)
 (setq f (strcat layfol "\\lxa.scr"))
 (setq ff (open f "w"))
 (write-line "model" ff)
 (foreach layout layouts
   (write-line "layout set" ff)
   (write-line layout ff)
   (setq adname (strcat (chr 34) layfol "\\" layout (chr 34)))
   (write-line "exportlayout" ff)
   (write-line adname ff)
 )
 (write-line "model" ff)
 (close ff)
 (command "script" f)
)

Posted

So you have the lisp part done already, now you need to create a batch file to work in windows to open (sorry I don't think you can avoid this) each dwg file and initialize the lisp. (not hard to do) It should be all automatic, it may take some time though. (And you need Autocad or Bricscad installed.) This should enable all to run unattended, so the time it takes becomes less of an issue.

 

The issue is once a drawing is closed any loaded lisp are unloaded and will not pass to a newly opened drawing, and you cannot run a lisp or script external to CAD.

Posted

If you know how you can make script files in a few minutes from scratch, there are some script generators, check out Lee-Mac.com he has one it will ask for directories and get the dwg names etc and build a script. Yeah go to lunch you will be suprised how fast you can churn through dwgs with no user interaction.

 

Not sure about this but start a 2nd session of autocad whilst one in background is processing.

 

Put your LXA into the autoloaded lsp ACADDOC.lsp etc then you only need (LXA) to call it every time rather than loading.

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