(defun c:yy() (setvar "cmdecho" 0) (princ "请选择需要打散的文字:") (setq text (car(entsel))) (setq te (entget text)) (setq text1 (cdr (assoc 1 te))) (setq high (cdr (assoc 40 te))) (setq lyr (cdr (assoc 8 te))) (setq zx (cdr (assoc 7 te))) (command "-layer" "s" lyr "") (command "-color" "bylayer") (if (/= "" (cdr(assoc 4 (tblsearch "style" zx )))) (setq zt (strcat (cdr(assoc 3 (tblsearch "style" zx ))) "," (cdr(assoc 4 (tblsearch "style" zx ))))) (setq zt (cdr(assoc 3 (tblsearch "style" zx )))) );end if (command "-style" zx zt "0" "1" "" "" "" "") (setq len (strlen text1)) (setq n 1) (setq j 1) (while(<= n len) (if(> (ascii(substr text1 n 1)) 127)(progn (setq stm (substr text1 n 2)) (princ "\n请指定第") (princ j) (princ "个点的位置:") (setq xy (getpoint)) (command "text" "j" "ml" (list (- (car xy) (/ high 2)) (cadr xy) ) high "0" stm) (setq j (+ j 1)) (setq n (+ n 2)))(progn (setq stm (substr text1 n 1)) (princ "\n请指定第") (princ j) (princ "个点的位置:") (setq xy (getpoint)) (command "text" "j" "ml" (list (- (car xy) (/ high 2)) (cadr xy) ) high "0" stm) (setq j (+ j 1)) (setq n (+ n 1))) );end if );end while (setvar "cmdecho" 1) (princ) );end defun 请选择需要打散的文字: 选择对象: 未知命令“YY”。按 F1 查看帮助。 请指定第1个点的位置: 请指定第2个点的位置: 请指定第3个点的位置: 能顺利执行,选择对象之后会出现错误“未知命令“YY”。按 F1 查看帮助” |