- ;按照颜色选取图元
- ;,| - - - - - - - - - - - - - - - - - - - -
- ;,| 函数编号:g0001
- ;,| - - - - - - - - - - - - - - - - - - - - -
- ;,|功能: 返回图元真实颜色
- ;,|参数:“ent”——图元名
- ;,|示例语句: (color (car (entsel "\n选择: ")))
- ;,|示例返回: 颜色码
- (DEFUN C:CV(/ co color enlst n s1 ss x)
- (defun color (ent / c62 ent1)
- (setq ent1 (entget ent))
- (if (setq c62 (cdr (assoc 62 ent1)))
- (if (= 0 c62)
- 7
- c62
- )
- (cdr (assoc 62 (entget (tblobjname "layer" (cdr(assoc 8 ent1))))))
- )
- )
-
- (redraw (setq s1 (car (entsel "\n选择要筛选的目标对像颜色: "))) 3)
- (setq co (color s1))
- (setq enlst (ssadd))
- (princ "\n选择目标窗口: ")
- (if (setq ss (ssget ))
- (repeat (setq n (sslength ss)) ; fixed
- (cond ((= co (color (setq x (ssname ss (setq n (1- n)))))) (ssadd x enlst)))
- ))
- (ssadd s1 enlst)
- (sssetfirst nil enlst)
- (COMMAND "ERASE" ENLST "" "")
- (princ )
- )
|