 - ;;; Ver3.0 2001.11.26 增加了缺省值和替换功能。
- ;;; Ver2.0 2001.03.15 更加简洁的处理,重写了Zoom部分和比例设置部分。
- ;;; Ver1.1
- ;;; Ver1.0
- (defun findt (ss / idx cnt key bsd)
- (setvar "cmdecho" 0)
- (setq idx 0)
- (setq cnt (sslength ss))
- (while (< idx cnt)
- (setq
- text_en (ssname ss idx)
- ent (entget text_en)
- pt0 (cdr (assoc 10 ent))
- str (cdr (assoc 1 ent))
- );setq
- (command "_zoom" "c" pt0 z_sc)
- (getkey)
- );while
- (if bsd nil (setq bsd cnt))
- (princ (strcat "\n" or_str " >> " (rtos cnt) " found, " (rtos bsd) " browsed. "))
- (setvar "cmdecho" 1)
- )
- (defun getkey ()
- (initget "Next Zoom Stop Replace")
- (setq key (getkword "\n<Next>/Zoom height/Stop/Replace: "))
- (if key nil (setq key "Next"))
- (cond
- ( (= key "Next") (setq idx (1+ idx)))
- ( (= key "Zoom") (setsc) (getkey))
- ( (= key "Stop") (setq bsd (1+ idx) idx cnt))
- ( (= key "Replace") (ft_rp) (setq idx (1+ idx)))
- )
- )
- (defun ft_rp (/ n_str)
- (if ft_new_str nil (setq ft_new_str ""))
- (princ (strcat "\nNew String: <" ft_new_str ">"))
- (setq n_str (getstring 1))
- (if (= n_str "") (setq n_str ft_new_str))
- (if (= n_str "")
- (ft_rp)
- (progn
- (setq ft_new_str n_str)
- (entmod (subst (cons 1 n_str) (assoc 1 ent) ent))
- )
- )
- )
- (defun setsc ()
- (princ (strcat "\nZoom height: <" z_sc ">: "))
- (setq z_sc (getint)
- z_sc (if z_sc (rtos z_sc) ft_z_sc)
- )
- (setq ft_z_sc z_sc)
- )
- (defun c:fft (/ str ss z_sc ent)
- (prompt "\nWritten by Little Fish, Dec 23 1996.")
- (prompt "\nFind text, ver 3.0, start as C:FFT")
- (setvar "highlight" 0)
- (if ft_z_sc nil (setq ft_z_sc "10000"))
- (if ft_dft_str nil (setq ft_dft_str ""))
- (setq z_sc ft_z_sc)
- (ft_get)
- (setq ft_dft_str or_str)
- (setq str (if ft_cas (strcase or_str) OR_STR))
- (setq ss (ssget "X" (list '(0 . "text") (cons 1 str))))
- (setvar "highlight" 1)
- (if ss (findt ss) (princ "Text not found."))
- (princ)
- )
- (defun ft_get ()
- (princ (strcat "\nText to search: <" ft_dft_str "> "))
- (setq or_str (getstring 1))
- (if (= or_str "") (setq or_str ft_dft_str))
- (if (= or_str "") (ft_get))
- )
- (princ "loaded. Start as C:FFT")
- (princ)
|