Can we do this with a block with Text Attributes...???
Here is a old lisp I have which I call Edit Any (text). Dtext, Mtext, dims, Text Attributes...
Is there away to add
((= etype "ATTDEF")
(strcat "Default " (cdr (assoc 3 elist)))
)
((= etype "ATTRIB")
(strcat "Attribute with Tag: " (cdr (assoc 2 elist)))
and have this increment those other types of text also...???
Thanks
Code:
;|
This routine will edit the following text type entities:
Text
Attributes
Attribute definitions
Dimension Text
|;
(defun catcherr (s)
(if (/= s "Function cancelled") ; If an error (such as CTRL-C) occurs
(princ (strcat "\nError: " s)) ; while this command is active...
)
(setq p nil) ; Free selection set
(setq *error* olderr) ; Restore old *error* handler
(princ)
)
(defun c:txe(; edit text type entities
/; no formal arguments
ent; entity info returned by nentsel
elist; entity list
etype; entity type
etype2; entity type for dialog box label
oldval; original text value
newval; new text value
elist2; new entity list
get_newval; local function
); end local variable list
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Start local functions ÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
(setq olderr *error*
*error* catcherr)
(defun get_newval(
oldval; old value to be changed
etype; entity type for dialog box label
/; end of formal argument list
); end of local variable list
(setq dcl_id (load_dialog "txe.dcl"))
(if (not (new_dialog "text_edit" dcl_id)) (exit))
(set_tile "text" oldval)
(if etype
(set_tile "box" etype)
)
(action_tile "text" "(setq newval $value)" )
(action_tile "accept" "(done_dialog 1)" )
(if (equal (start_dialog) 1)
nil
(setq newval nil)
)
(unload_dialog dcl_id)
newval
); end get_newval
;ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ Start Main Function ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
(while (setq ent (nentsel))
(setq
ent2 ent
elist (entget (car ent))
etype (cdr (assoc 0 elist))
); end setq
(if (member etype '("TEXT" "ATTDEF" "ATTRIB" "MTEXT"))
(progn
(setq
etype2 (cond
((= etype "ATTDEF")
(strcat "Default " (cdr (assoc 3 elist)))
)
((= etype "ATTRIB")
(strcat "Attribute with Tag: " (cdr (assoc 2 elist)))
)
((= etype "TEXT")
(if (= 4 (length ent))
(progn
(setq
diment (car (last ent))
dimlist (entget diment)
); end setq
(if (= "DIMENSION" (cdr (assoc 0 dimlist)))
"Dimension Text"
"Nested text"
); end if dimension?
); end progn nested entity
); end progn nested entity
); end cond text
); end cond etype
oldval (cdr (assoc 1 elist))
newval (get_newval oldval etype2)
elist2 (if newval
(subst (cons 1 newval) (assoc 1 elist) elist)
nil
); end if newval returned
); end setq
(if elist2
(progn
(entmod elist2)
(if (= 4 (length ent))
(progn
(setq
diment (car (last ent))
dimlist (entget diment)
); end setq
(if (= "DIMENSION" (cdr (assoc 0 dimlist)))
(progn
(setq dimlist2 (subst (cons 1 newval) (assoc 1 dimlist) dimlist))
(entmod dimlist2)
(entupd diment)
); end progn
); end if dimension
(if (= "INSERT" (cdr (assoc 0 dimlist)))
(entupd diment)
); end if insert
; (setq cmdecho (getvar "cmdecho"))
; (command "dim" "update" diment "" "e")
); end progn ent is nested
(entupd (cdr (assoc -1 elist)))
); end if ent is nested?
); end progn elist2 exists
); end if elist2 exists?
); end progn correct type of entity
(princ "\nNot a text, attdef or attribute entity. ")
); end if
); end while
(princ)
); end c:txe
(princ "\nC:TXE To Edit Any Text\n")
(princ)