PDA

View Full Version : Applying Script To Multiple layouts problem?



pierredib
2008-07-26, 11:16 AM
Hello All:
This is the Problem I can't find a solution for:
I'm working with drawings and each drawing contains 4 layouts,1 layout for every zone of the basements (every basement floor has 4 zones=>4 layouts for the same floor with 1 architectural xref ).I'm running a batchscript that opens the file ,erase the title block, replace it with another block ,zoom extents in tilemode=0 and tilemode =1, do a qsave then exit and start with another file,it's working for the first layout but the other 3 layouts are still the same with no modifications,Is there a way to issue a command that will switch from one layout to the next so I can repeat the same script for the other 3 layouts.does anyone have a script that will do this sequential switch from 1st layout to all other layouts on the same file.Any help is appreciated.

irneb
2008-08-13, 01:08 PM
You'll have to add some LISP to your script, e.g. (remove the comments marked in green):
;; Get a VLAX handle to the document
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
;; Get the collection of Layouts
(setq tabs (vla-get-Layouts doc))
;; Step through each layout
(vlax-for tab tabs
;; Check if not Model tab
(if (not (vla-get-Name tab) "Model")
(progn
(setvar "CTAB" (vla-get-Name tab)) ;Open current tab
(command "_ERASE" (ssget "x" '((0 . "INSERT") (2 . "OldBlockName"))) "") ;Command to erase old TB
(command ".-INSERT" "c:\\Path\\NewBlockName.DWG" "0,0" "" "" "");Command to insert new
(command "_ZOOM" "_Extents")
)
)
)
TILEMODE 1
ZOOM E
QSAVE