Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACAD 2005 - SINGLE LINE TEXT - REPLACEMENT

Status
Not open for further replies.

SeanSweeney

Civil/Environmental
Mar 16, 2005
173
0
0
NO
NOT ACTUALLY REPLACEMENT. I HAVE 419 TEXT ENTITIES 1 TO 419. I NEED TO RENAME THEM TO BR1 - BR419.

ANY IDEAS?
 
Replies continue below

Recommended for you

I FOUND IT MYSELF - VERY CLEVER WHOEVER IT WAS THAT WROTE IT - CHEERS

;PRETX - Prefix all text with a string
;
;Jeffery P Sanders
;
(defun C:pRETX (/ sset len cnt ed en xscmde)
(setq xscmde (getvar "cmdecho")) ;get echo setvar
(setvar "cmdecho" 0) ;turn echo off
(setq str (getstring T "\n \nPrefix: ")) ;get prefix string
(setq cnt 0 sset (ssget)) ;select objects
(princ "\n \n.....Working......") ;clear command line
(setq len(sslength sset)) ;get length of set
(while (> len 0) ;while length > 0
(setq en (ssname sset 0)) ;get entity name
(setq ed(entget en)) ;get entity data
(if (= (cdr (assoc 0 ed)) "TEXT") ;if entity is text
(progn ;
(setq ed ;
(subst (cons 1 (strcat str (cdr(assoc 1 ed))));add prefix to text
(assoc 1 ed) ;
ed ;
) ;
) ;
(entmod ed) ;update database
(setq cnt(+ cnt 1)) ;count changes
) ;
) ;
(setq sset (ssdel en sset)) ;delete from set
(setq len(- len 1)) ;decrease length of set
) ;
(setvar "cmdecho" xscmde) ;reset echo to previous
(princ "\n ") ;
(princ "\nPrefixed ") ;
(princ cnt) ;print number of changes
(princ " Lines Of Text With ")(princ str) ;
(princ "\n ") ;
(princ) ;
) ; end
 
Status
Not open for further replies.
Back
Top