【K:ChgSSgetOrder】选择集对象置顶OR置底
分享一个函数:;CorLst:颜色列表
;LayLst:图层列表
;Type:置顶"F"或置底"B"
(defun K:ChgSSgetOrder (CorLst LayLst Type / TmpLay CorLayLst SS)
(if CorLst
(progn
(setq CorLayLst Nil)
(while (setq TmpLay (tblnext "LAYER" (null TmpLay)))
(if (member (cdr (assoc 62 TmpLay)) CorLst)
(setq CorLayLst (cons (cdr (assoc 2 TmpLay)) CorLayLst))
)
)
)
);获取符合颜色列表的图层
(if (or CorLst LayLst)
(progn
(setq SS
(ssget "X"
(append
(if (eq 1 (getvar "cvport")) (list (cons 410 (getvar "ctab"))) (list (cons 410 "Model")));模型OR布局
(list (cons -4 "<OR"))
(if CorLst
(append
(list (cons -4 "<OR"))
(mapcar '(lambda (x) (cons 62 x)) CorLst)
(list (cons -4 "OR>"))
)
)
(if LayLst
(append
(list (cons -4 "<OR"))
(mapcar '(lambda (x) (cons 8 x)) LayLst)
(list (cons -4 "OR>"))
)
)
(if CorLayLst
(append
(list (cons -4 "<and"))
(list (cons 62 256));随层
(list (cons -4 "<OR"))
(mapcar '(lambda (x) (cons 8 x)) CorLayLst)
(list (cons -4 "OR>"))
(list (cons -4 "and>"))
)
)
(list (cons -4 "OR>"))
)
)
)
(command "_DrawOrder" SS "" Type)
)
)
(princ)
)
;用法参考
(K:ChgSSgetOrder
'(8 250 251 252 253 254 255);灰色对象
'("LayNam1" "LayNam2");图层列表:不知道为什么不能包含"0"图层
"B" ;置底
)
感谢大佬分享
页:
[1]