;; Ersetzt global Textstrings ;; Bsp.: (Ersetzer "35" "25") aendert alle Textstrings "35" nach "25" ;; UND JA NICHT DIE ANFÜHRUNGSZEICHEN VERGESSEN ! ;; ;; 1.0 ;; Aug., 2001 ;; CADchup@cad.de ;;-------------------------------------------------------------------- (defun Ersetzer (fin repl / ss l n e as op x) (setq ss (ssget "X" (list (cons 0 "TEXT") (cons 1 (strcat "*" fin "*"))))) (if ss (progn (setq l 0) (setq n (sslength ss)) (while (< l n) (setq e (entget (ssname ss l))) (setq as (assoc 1 e)) (setq op (cdr (assoc 1 e))) (setq x (STD-STRCHG op fin repl)) (setq e (subst (cons 1 x) as e)) (entmod e) (setq l (1+ l)) ) ; while (princ (strcat "\n" (itoa (sslength ss)) " Texte geaendert.")) ) ; progn (alert (strcat "Text " fin " nicht gefunden")) ) ; if (princ) ) ;;; ;;; The following code is taken from Reini Urbans STDLIB. ;;; ;;; ;;; $Id: STDSTR.LSP 0.5004 2000/09/20 12:48:22 rurban Exp $-*-AutoLISP-*- ;;; Time-stamp: <2000-10-03 00:56:55 rurban> ;;; Copyright (c) 1998,99,2000 by Reini Urban ;;; Available for free at http://xarch.tu-graz.ac.at/autocad/stdlib/ ;;; ;;; Permission to use, copy, modify and distribute this software and its ;;; documentation for any purpose is hereby granted without fee, provided ;;; 1) that the above copyright notice appear in all copies, ;;; 2) that the copyright notice, this permission notice and the pointer ;;; where to download the source code for free appear in the ;;; supporting documentation of source code distributions, ;;; 3) that the name of Reini Urban not be used in advertising or ;;; publicity pertaining to distribution of the software and ;;; 4) that modifications without changing the defined function and ;;; symbol names may not be published, distributed nor copied ;;; without specific, written prior permission. ;;; ;;; No Warranty ;;; Reini Urban makes no representations about the suitability of this ;;; software for any purpose, without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It is provided ;;; "as is" without express or implied warranty. ;;; See the full Disclaimer for all detailed warranty exclusions. ;;; -------------------------------------------------------------------- ;;; String function for the STDLIB (defun STD-STRCHG (s old new / i ls lold) (if (= old "") (strcat new s) (progn (setq lold (strlen old) ; length of substr to search ls (1+ (- (strlen s) lold)) ; max. position to search to i 1) (while (<= i ls) (if (= (substr s i lold) old) ; found (setq s (strcat (if (> i 1) (substr s 1 (1- i)) "") new (if (<= i ls) (substr s (+ i lold)) "")) i (+ i (strlen new))) ; next position to search (setq i (1+ i)) ) ) s ))) ;;; ;;; ;;; (princ "\nErsetzer geladen.") (princ)