@Anonymous wrote:
I've attached a sample DWG that I need a solution for it, I've more than 200 layouts that all of them have my own template with attributes text, however I need a routine to change my numbers to be sequentially without changing it one by one. for example in the attached file I've DWG_NO which is WWE-01 for all the layouts. I want the number to be sequentially for all layouts without selecting the template and change each one. note that template is a block. thanks in advance
Try this......(For this Particular Block "AWD_TB_11x17" with the particular Tag Name "DWG_NO" in any drawing)
(defun C:tabnumber (/ layt_lst lay_list blk_name tag_name layoutname);;Put temp variables
(vl-load-com)
(setq blk_name "AWD_TB_11x17"
tag_name "DWG_NO"
l -1
tab (getvar 'CTAB)
)
(vlax-for layt (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (> (vla-get-TabOrder layt) 0)
(setq layt_lst (cons (cons (vla-get-TabOrder layt) (vla-get-Name layt)) layt_lst))
)
)
(setq layt_lst (vl-sort layt_lst '(lambda (x y) (< (car x) (car y)))))
(foreach layt layt_lst
(setq layoutname (cons (cdr layt) layoutname))
)
(setq lay_list (reverse layoutname))
(repeat (length lay_list)
(setq lay_name (nth (setq l (+ l 1)) lay_list))
(setvar 'CTAB lay_name)
(setq ss (ssget "_A" (list '(0 . "INSERT")(cons 2 blk_name)(cons 410 lay_name))))
(repeat (setq NOS (sslength ss))
(vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(if (= (vla-get-Name blk) blk_name)
(progn
(setq obj (vlax-ename->vla-object (ssname SS (setq NOS (- NOS 1)))))
(foreach att (vlax-invoke Obj 'GetAttributes)
(if (= (vla-get-Tagstring att) tag_name)
(progn
(vla-put-textstring att lay_name)
)
)
)
)
)
)
)
)
(setvar 'CTAB tab)
(princ)
)
Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....