Layout Question

Mark Douglas

Usenet Archive
Joined
Jul 7, 2003
Messages
48
Reaction score
0
Does anyone know the bit of code to retrieve all the Layout names in a Drawing? I want my code to insert a block on every layout tab in my drawing at 0,0. And then explode it?

Thanks if anyone has a quick little code

Mark
 
Ok how do i make it activate each layout tab so I can insert a block on each one?
Mark
 
(setvar "ctab" "tabUwantCurrent")

HTH,
Jeff

Mark Douglas said:
Ok how do i make it activate each layout tab so I can insert a block on each one?
Mark
 
One way would be:

(foreach x (layoutlist)
(setvar "ctab" x)
(command ".insert" ......)
)

You might watch out for (layoutlist) returning "Model". Sometimes it does other times it doesn't (was/is a bug)

Or you could try and use activeX methods so you don't
have to switch to each tab.
 
(defun C:blahb
(setq blah (layoutlist))
(setq ctr 0)
(while (/= (nth ctr blah) nil)
(princ (nth ctr blah))
(setq ctr (1+ ctr))
)
)

something kinda like this?
 
nm..i forgot about the foreach function :\

Jaime
 
Thanks Guys, I got it to work with a few modifications....Works great and saves a lot of time!!
Mark
 
Here's a quick 'n dirty vla- way. No jumping from tab to tab.

BTW, Mark......do you work for the MKM in Santa Rosa, Calif.? If so, tell Larry & Jeff I said "Hi!", I used to work with them many moons ago.

HTH,
Jeff

;;;Insert a block into all PaperSpace Layout Tabs,
;;;all at 0,0,0 & 0 deg. rotation
;;;by Jeff Mishler, January 2004

(defun c:ins2tabs ( / lays bname blk newblk)
(setq lays (vla-get-layouts
(vla-get-activedocument
(vlax-get-acad-object)))
bname (getstring "\nBlock to insert in all Layouts?: ") ) (if (not (tblsearch "block" bname)) (progn (princ "\nBlock not found, please select block: ") (setq bname (getfiled "Block Selection for Tab Insert" bname "dwg" 0)) ) ) (vlax-for x lays (if (not (= "Model" (vla-get-name x))) (progn (setq blk (vla-get-block x) newblk (vlax-invoke-method blk 'insertblock (vlax-3d-point '(0.0 0.0 0.0)) bname 1.0 1.0 1.0 0.0)) ;;; (vla-add (vla-get-layouts ;;; (vla-get-activedocument ;;; (vlax-get-acad-object))) "Title") ;;; (vla-put-layer newblk "Title") ;;; uncomment above to place on layer other than the current one (vla-explode newblk);;comment this if not exploding (vla-delete newblk);;comment this if not exploding ) ) ) (princ)
)
 
Yup I work here with Larry and Jeff, I'll let them know you said Hi!! And also Thanks for the help Mark
 

Member Recommended

Back
Top