wimal 发表于 2022-7-5 19:22:01

Tharwat先生为什么我不能这样用呢
 
(defun c:Test (/ ss sn p st efind replase)
;; Tharwat 29.9.2015 ;;

(setq find (getstring "Find "))
(setq replace (getstring "Replase "))



(if (setq ss (ssget "_:L" '((0 . "TEXT")(1 . *find*))))
(while (setq sn (ssname ss 0))
   (if (setq p (vl-string-search exist (setq st (cdr (assoc 1 (setq e (entget sn)))))))
   (entmod (subst (cons 1 (strcat (substr st 1 p) replace (substr st (+ 3 p)))) (assoc 1 e) e))
   )
   (ssdel sn ss)
   )
)
(princ)
)

Tharwat 发表于 2022-7-5 19:25:35

 
查看更改:
 

(defun c:test (/ ss sn st e find replace)
;; Tharwat 29.9.2015 ;;
(if (and (/= "" (setq find (getstring "\nFind :")))
          (/= "" (setq replace (getstring "\nReplace :")))
          (setq
            ss (ssget "_:L"
                      (list '(0 . "TEXT") (cons 1 (strcat "*" find "*")))
               )
          )
   )
   (while (setq sn (ssname ss 0))
   (setq e(entget sn)
         st (cdr (assoc 1 e))
   )
   (entmod (subst (cons 1 (vl-string-subst replace find st))
                  (assoc 1 e)
                  e
             )
   )
   (ssdel sn ss)
   )
)
(princ)
)

wimal 发表于 2022-7-5 19:34:29

谢谢。

Tharwat 发表于 2022-7-5 19:35:05

 
不客气。
页: 1 [2]
查看完整版本: 在dded中选择指定文本