Alright here goes:
It is unfinished but should run. I tried to compile all the utility functions and variables into this code from my toolbox so holler if you are missing something.
Lisp code:
(defun c:att (/ attlist strlist *acad*
*adoc* *layouts* *layout_list*
*sort* *get_atts* *dialog*
)
;;;
(setq *acad* (vlax-get-acad-object))
(setq *adoc* (vla-get-activedocument *acad*))
(setq *layouts* (vla-get-layouts *adoc*))
(defun *layout_list* (/ lst)
(vlax-map-collection
*layouts*
'(lambda (x) (setq lst (cons x lst)))
)
(cdr
(*sort* lst 'vla-get-taborder)
)
)
;;;
(defun *sort* (lst func)
(vl-sort lst
'(lambda (e1 e2)
(< ((eval func) e1) ((eval func) e2))
)
)
)
;;;
(defun *get_atts* (obj)
(vlax-safearray->list
(vlax-variant-value
(vla-getattributes
(if (eq (type obj) 'ENAME)
(vlax-ename->vla-object obj)
obj
)
)
)
)
)
;;;
(defun *dialog* (lst / id eb1 selection)
;
(defun on_list_pick ()
(if (= (get_tile "atts") "")
(mode_tile "select" 1)
(mode_tile "select" 0)
)
)
;
(and (setq id (load_dcl "att.DCL"))
(start_list "atts")
(mapcar 'add_list lst)
(not (end_list))
(action_tile "cancel" "(done_dialog 0)")
(action_tile
"update"
(strcat
"(setq selection (get_tile \"atts\"))"
"(setq eb1 (atoi (get_tile \"eb1\")))(done_dialog 1)"
)
)
(action_tile
"apply"
"(done_dialog 2)"
)
(action_tile "atts" "(on_list_pick)")
(not (mode_tile "update" 1))
(not (mode_tile "apply" 1))
(start_dialog)
(not (unload_dialog id))
)
(if selection
selection
(*error* "No selection made ")
)
)
;;;
;;;
;;;
(defun load_dcl (name / dcl dcl_id)
(while
(if (minusp (setq dcl_id (load_dialog name)))
(setq dcl (getfiled "Select correct DCL file location: "
dcl
"dcl"
(+ 8 128)
)
)
(not (new_dialog "attribute_edit" dcl_id))
)
)
dcl_id
)
;;;
(defun *error* (msg)
(princ "\nError: ")
(princ msg)
(princ)
(gc)
(princ)
)
;;;
;;;
;;;
(setq attlist (mapcar
'(lambda (x)
(vlax-for obj (vla-get-block x)
(if (and (eq (vla-get-objectname obj)
"AcDbBlockReference"
)
(eq (vla-get-name obj) "R-TB30X42")
)
(car
(vl-remove
nil
(mapcar '(lambda (y)
(if (eq (vla-get-tagstring y) "XXX")
(list x y)
)
)
(*get_atts* obj)
)
)
)
)
)
)
(*layout_list*)
)
strlist (mapcar '(lambda (z)
(strcat (vla-get-name (car z))
"\t"
(vla-get-textstring (cadr z))
)
)
attlist
)
)
(*dialog* strlist)
(princ)
)
Dcl file:
attribute_edit : dialog {
label = "Attribute Edit";
: list_box {
key = "atts";
tabs = "30";
height = 12;
multiple_select = true;
}
:boxed_column {
label = "\"Number Of\" to match Index of Drawings";
:edit_box {
key = "eb1";
label = " Enter starting sheet number:";
edit_limit = 4;
width = 30;
action = "";
}
}
:row {
: button {
label = "&Update";
key = "update";
width = 10;
}
: button {
label = "&Apply";
key = "apply";
width = 10;
}
: button {
label = "&Cancel";
is_cancel = true;
key = "cancel";
width = 10;
}
}
:spacer_1 {
}
:text_part {
label = "Copyright 2005 Will DeLoach";
}
}
and a test dwg:
When run you should get a dialog box with the tab name and 'XXX' on the same line in the dialog box.
Thanks for all your help,