好心人求助!修改块内的文字,让该文字数值加24
(defun c:cadd(/ e el pjsl s1)(and(setq e(nentselp "\n选择块内实体:\n"))
(= (length e) 4)
)
(setq el (entget (car e)));1
(if (= (cdr (assoc 0 el)) "TEXT")
(setq s1 (cdr (assoc 1 el)))
(princ "选择的对象不是块内文字对象")
)
(setq pjsl (atoi s1)) (princ pjsl)
;;
(setq pjsl (+ 24 pjsl))
(princ pjsl)
(PRINC))
;;-----------------
chenjieq1990 发表于 2017-10-17 21:59
(= (length e) 4)这个是干嘛的?
原始代码里有这句 没改
作用就是限制只能对块内文字有效。 (defun c:cadd (/ e el pjsl s1)
(if (and (setq e (nentselp "\n选择块内实体:\n"))
(= (length e) 4)
(setq el (entget (car e)))
(= (cdr (assoc 0 el)) "TEXT")
(setq s1 (cdr (assoc 1 el)))
)
(progn
(setq pjsl (+ 24 (atoi s1))
el (subst (cons 1 (itoa pjsl)) (assoc 1 el) el)
)
(entmod el)
(entupd (car (last e)))
)
(princ "选择的对象不是块内文字对象")
)
(princ)
) (defun c:tt ()
(if (and (setq e (nentselp "\n选择块内数字文本: "))
(= (length e) 4)
(setq el (entget (car e)))
(= (cdr (assoc 0 el)) "TEXT")
(setq tx (cdr (assoc 1 el)))
(distof tx)
)
(setq tx (+ 24 (atoi tx))
el (subst (cons 1 (itoa tx)) (assoc 1 el) el)
el (entmod el)
e(entupd (car (last e)))
)
)
(princ)
) vectra 发表于 2017-10-7 20:05
谢谢好心人! 谢谢!vectra分享程序!!! 非常感谢,很好的代码。 好东西,顶顶顶 虽然用不着,还是顶一下 vectra 发表于 2017-10-7 20:05
(= (length e) 4)这个是干嘛的?
页:
[1]
2