Updateing Attribute in layout tabs

Updateing Attribute in layout tabs

Anonymous
Not applicable
251 Views
1 Reply
Message 1 of 2

Updateing Attribute in layout tabs

Anonymous
Not applicable
Hi,
I'm trying to write a Lisp routine that will update a date attribute in all the layout tabs in my dwg.
I have successfully wrote one for a single tab dwg but now want the routine to the same but for all layouts in my dwg.

Here is what i have done so far.
The routine scrolls thru the layouts but only updates the Date attribute on the last tab

(defun C:PDT()
;(setvar "cmdecho" 0)


(setq today (menucmd "m=$(edtime,$(getvar,date),mo.dd.yy)"))
(setq Tag (ssget "x" (list (cons 0 "insert") (cons 2 "ttlblk-attribute"))))
(setq Block (entget (ssname Tag 0)))
(setq Att (entget (entnext (cdr (assoc -1 Block)))))
(setq OldDate (cdr (assoc 1 Att)))
(setq Data (subst (cons 1 OldDate) (assoc 1 Att) Att))
(entmod Data)

(foreach layout (layoutlist)
(setvar "ctab" layout))
(command ".-attedit" "n""n" "*" "XX-XX-XXXX" "" OldDate today)

;(command "graphscr")
;(setvar "cmdecho" 1)
(PRINC))

I have been scrolling thru the forums here but can't find something that helps me get over the final hurdle.
from info gained from the forums I thought the above would get a list of the layouts and switch from layout to layout and execute the command??

Any and all help much appreciated.

Thx in advance

Paul
0 Likes
252 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Ok on further trial and error below seems to work

(foreach layout (layoutlist)
(command ".-attedit" "n""n" "*" "XX-XX-XXXX" "" OldDate today)
(setvar "ctab" layout))
(command ".-attedit" "n""n" "*" "XX-XX-XXXX" "" OldDate today)

One funny incident on One Dwg, my working Dwg, it places the date on the first layout twice but on other dwgs it works fine.
0 Likes