IF判断求教
查询对象颜色判断,对象为随层颜色时可以显示颜色色号,但是对象单独设置颜色后(1-255),就显示错误Error: 参数类型错误: consp 1,例如:某图层线段随层色为白色,单独设置线段为1号色, 以下代码出错,请大佬指点如何修改?(if (not col)
(setq col 256)
(setq col (cdr col))
)
(princ (strcat "\n" (cdr (assoc 0 en)) ","))
(cond
((= col 256)
(setq lc (cdr (assoc 62 (tblsearch "layer" (cdr (assoc 8 en)))))
)
(princ (strcat "Bylayer(" (colorname lc) ")"))
)
((= col 0)
(princ (strcat "0 Byblock"))
)
(t (princ (assoc 62 en)))
)
(defun c:tt5 (/ col en etype)
(setq en (entget (car (entsel "\n选择对象:"))) col(cdr (assoc 62 en)) etype (cdr (assoc 0 en)))
(cond
((not col)
(setq col (cdr (assoc 62 (tblsearch "layer" (cdr (assoc 8 en))))))
(princ (strcat etype ",Bylayer(" (itoa col) ")"))
)
((= col 0)
(princ (strcat etype ",Byblock(0)"))
)
(t (princ (strcat etype "," (itoa col))))
)
(princ)
) start4444 发表于 2022-7-16 02:47
(defun c:tt5 (/ col en etype)
(setq en (entget (car (entsel "\n选择对象:"))) col(cdr (assoc 62 e ...
这么晚还帮我解决了困扰几天的问题,非常感谢,大师就是不一样,代码精简漂亮。已经多次帮我解决问题了,再次感谢!
页:
[1]