【K:Cecolor4ACI】获取当前色的ACI近似色
本帖最后由 kucha007 于 2024-4-5 19:13 编辑(defun K:Cecolor4ACI (/ LayObj CurCol AciCol LayLck TmpEn)
(setq LayObj (vlax-ename->vla-object (tblobjname "LAYER" (getvar "CLAYER"))));当前层
(setq CurCol (getvar "CECOLOR"))
(cond
((<= 1 (atoi CurCol) 255)(setq AciCol (atoi CurCol)));1~255
((= "BYBLOCK" CurCol) (setq AciCol 7));随块0
((= "BYLAYER" CurCol) (setq AciCol (vla-get-Color LayObj)));随层取层色
(T
(setq LayLck Nil)
(if (eq (vla-get-lock LayObj) :vlax-true);锁定了
(progn
(setq LayLck T)
(vla-put-lock LayObj :vlax-false);解锁
)
);临时解锁当前层
(setq TmpEn (entmakeX (list '(0 . "POINT") (cons 10 '(0.0 0.0 0.0)))));创建临时实体
(setq AciCol (cdr (assoc 62 (entget TmpEn))))
(if TmpEn (vla-Delete (vlax-ename->vla-object TmpEn)));删除临时实体
(if LayLck (vla-put-lock LayObj :vlax-false));重新锁定当前层
);RGB或其它
)
AciCol
)
主要用途:
(grdraw (getpoint) (getpoint) (K:Cecolor4ACI));UCS 感谢大佬分享 感谢分享,赞
感谢大佬分享
页:
[1]