不知道为什么提示未知命令呢??
(defun c:xx()(setq ss (ssget))
(setq i 0)
(repeat (sslength ss)
(setq aa (nth i ss))
(setq sc (strlen aa))
(if (= sc 8)
(setq q2 (substr aa 1 2))
(setq q3 (substr aa 5 3))
(setq new (strcat q2 "0" "x" q2 "0"))
(func1)
)
(if (= sc 7)
(setq q2 (substr aa 1 2))
(setq q3 (substr aa 5 2))
(setq new (strcat q2 "0" "x" q2 "0"))
(func1)
)
(setq i (1+ i))
)
)
(defun func1()
(setq ent_list (entget aa))
(setq ent_1_old (assoc 1 ent_list))
(setq ent_1_new (cons 1 new))
(SETQ ent_list (subst ent_1_new ent_1_old ent_list))
(entmod ent_list)
)
;;;先是把第三个数字弄为0,在把最后一个弄成(因为有500x1000和500x00两种情况,所以第
三个是确定的但是最后一个的是第几个不确定)
错误太多(defun c:xx()
(setq ss (ssget '((1 . "*#x#*"))))
(setq i 0)
(repeat (sslength ss)
(setq ent (entget(ssname ss i)))
(setq aa (cdr(assoc ent)))
(setq sc (strlen aa))
(if (< 6 sc 9) (progn
(setq q2 (substr aa 1 2))
(setq q3 (substr aa 5 (- sc 5)))
(setq new (strcat q2 "0" "x" q3 "0"))
(entmod (subst (cons 1 new) (assoc 1 ent) ent))
))
(setq i (1+ i))
)
(princ)
)
页:
[1]