;*************************************************************************** ; ; Program Name: C:MATCHTXT ; Description: Match text values in attributes or text strings. ; Pick a text or attribute entity and match the value with ; the destination text or attribute entities. ; ; Date: 10/11/2000 ; Version: 1.02 ; Autocad: r14 ; Author: Peter Permentiers ; Email: peter.permentiers@pandora.be ; Guarantee: None ; ;*************************************************************************** (defun UNDO-BEGIN () (command "UNDO" "BEGIN") ) (defun UNDO-EIND () (command "UNDO" "END") ) (defun ERRHAND (MSG) (if (/= MSG "Function cancelled") (progn (princ (strcat "\nFunction terminated" )) (setvar "SNAPMODE" OUDE-SNAP) (redraw) (setq *ERROR* OUDE-ERR) (UNDO-EIND) (princ) ) ) ) (defun ERR-BEGIN () (setvar "CMDECHO" 0) (setq OUDE-ERR *ERROR* *ERROR* ERRHAND ) ) (defun ERR-EIND () (setq *ERROR* OUDE-ERR) (princ) ) (defun C:MATCHTXT ( / BRON_ENT ; bron-entiteit BRON_TEKST ; tekst van de bron-entiteit BRON_SEL ; selectiegegevens van bron-entiteit BRONPUNT ; beginpunt van aanduidingslijn DOEL_ENT ; doel-entiteit DOELPUNT ; selectiepunt van doel-entiteit LIJNTELLER ; teller die de zichtbaarheid van de aanduidingslijn regelt LIJNVLAG ; regelt het einde van de aanduidingslijn MATCHVLAG ; regelt het herhelen van doel-entiteit SURSORPUNT ; eindpunt van aanduidingslijn OUDE-SNAP ; snap-instelling OUDE-ERR ; error-instelling ) (ERR-BEGIN) (UNDO-BEGIN) (setq OUDE-SNAP (getvar "SNAPMODE")) (setvar "SNAPMODE" 0) (setq BRON_SEL (nentsel "\nSelect source text or attribute.") BRONPUNT (car (cdr BRON_SEL)) BRON_ENT (car BRON_SEL) LIJNTELLER 0 MATCHVLAG T ) (if (AND (/= (cdr (assoc 0 (entget BRON_ENT))) "ATTRIB") (/= (cdr (assoc 0 (entget BRON_ENT))) "TEXT")) (princ " Entity must be a text or attribute !") (progn (setq BRON_TEKST (cdr (assoc 1 (entget BRON_ENT)))) (while MATCHVLAG (setq CURSORPUNT nil LIJNVLAG T ) (princ "\n Select text or attribute to change. ") (while LIJNVLAG (setq CURSORPUNT (grread T 5 2)) (if (= 11 (car CURSORPUNT)) (progn (setq MATCHVLAG nil) (redraw) ) (setq MATCHVLAG T) ) (setq DOELPUNT (car (cdr CURSORPUNT))) (grdraw BRONPUNT DOELPUNT 7) ;7=wit (if (= (/ LIJNTELLER 3.0)(/ LIJNTELLER 3)) (redraw) ) (setq LIJNTELLER (+ LIJNTELLER 1)) (if (= LIJNTELLER 1000) (setq LIJNVLAG nil) ) (if (= 3 (car CURSORPUNT)) (progn (setq LIJNVLAG nil) (redraw) ) ) ) (if (= nil (setq DOEL_ENT (car (nentselp DOELPUNT)))) (princ " Nothing selected, retry !") (progn (if (AND (/= (cdr (assoc 0 (entget DOEL_ENT))) "ATTRIB") (/= (cdr (assoc 0 (entget DOEL_ENT))) "TEXT") ) (princ " No text or attribute selected, retry !") (progn (setq DOEL_ENT (entget DOEL_ENT)) (entmod (subst (cons 1 BRON_TEKST)(assoc 1 DOEL_ENT) DOEL_ENT )) (entupd (cdr (assoc -1 DOEL_ENT))) ) ) ) ) ) ) ) (setvar "SNAPMODE" OUDE-SNAP) (UNDO-EIND) (ERR-EIND) ) ; defun C:MATCHTXT