วันอาทิตย์ที่ 26 เมษายน พ.ศ. 2563

Find Text Replace with Blocks


;|     
       Find Text Replace with Blocks
       - Enter Text String
       - Enter Block Name
|;
(defun c:t2b( / ss)
(setq old_cmdecho  (getvar "cmdecho"))
(setvar "cmdecho" 0)
(vl-load-com)
       (or txt (setq txt "CL"))
       (setq txt (getstring t (strcat "\nFind Text: <" txt "> :")))
       (if (= txt "")(setq txt "CL"))
;-----------------------------------
       (or blk (setq blk "CL100"))
       (setq blk (getstring t (strcat "\nBlock Name: <" blk "> :")))
       (if (= blk "")(setq blk "CL100"))
;-----------------------------------
       (setq ss (ssget "X" (list(cons 0 "*TEXT")(cons 1 txt))))
       (if ss
              (progn
                     (setq ss (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
                     (mapcar '(lambda (x) (vl-cmdf "-insert" blk (cdr (assoc 10 (entget x))) 1 1 (* (/ 180 pi)
                                                                                                (cdr (assoc 50 (entget x)))))
                                  (entdel x)) ss
                     )
              )
              (princ "\nNo text entities found.")
       )
(setvar "cmdecho" old_cmdecho)
(princ)
);end
(prompt "\nEnter T2B to start. Find Text Replace with Blocks. ")

ไม่มีความคิดเห็น:

แสดงความคิดเห็น