更改文本颜色
我有这个复制粘贴autolisp,我缝合了从不同的人(因为IDK如何编码)但我被困住了。。我想做的是选择所有文本并全部更改
我的复制粘贴代码是针对单个文本。。。
(defun c:TcolAu (/ hcol clr pt1 ss)
(While T
(setq ss (ssget "_:S" '((0 . ",TEXT"))))
(setq hcol (atof(cdr (assoc 1 (entget (ssname ss 0))))))
(cond
((<= hcol 0.09)(setq clr 252))
((<= hcol 0.49)(setq clr 5))
((<= hcol 0.99)(setq clr 3))
((<= hcol 1.99)(setq clr 2))
((<= hcol 2.99)(setq clr 30))
((>= hcol 3)(setq clr 6))
)
(command "change" ss "" "_p" "Color" clr "")
(princ)))
no sir, i mean how can i change my code to select all text and change the color based on the value of the text...
the one you gave will actually make the process longer if i use "search" haven't got a drawing to test it on so untested :
(defun c:foo (/ ss hcol clr e) (if (setq ss (ssget "_X" (list '(0 . "TEXT")))) (foreach e (mapcar 'cadr (ssnamex ss)) (setq hcol (atof (cdr (assoc 1 (entget e))))) (cond (( Hi,
My attempt.
(defun c:foo (/ str int sel ent get lst) (and (setq str "" lst '(("0.09" 252) ("0.49" 5) ("0.99" 3)) ;; add your more desired of strings with colours here int -1 sel (ssget "_X" (list '(0 . "TEXT") (cons 1 (apply 'strcat (mapcar '(lambda (u) (setq str (strcat (car u) ","))) lst ) ) ) ) ) ) (while (setq ent (ssname sel (setq int (1+ int)))) (entmod (append (setq get (entget ent)) (list (cons 62 (cadr (assoc (cdr (assoc 1 get)) lst)))) ) ) ) ) (princ))
页:
[1]