本帖最后由 llsheng_73 于 2023-9-6 21:33 编辑
- ;|code 6,62,370三组任意组合f"or"或"and"或者当code为nil时任意字符串,dxf当code为nil时可任意,否则不应含code里边组和-4组
- (SELECTBYLAYER'((0 . "circle")) '((62 . 1)(370 . 100))"or")
- (sslength(SELECTBYLAYER'((0 . "circle")) nil""))|;
- (Defun STB(TAB f / d a)
- (While(SetQ a(TblNext TAB(not d)))
- (SetQ d(Cons a d)))
- (if f(mapcar'cdadr d)d))
- (defun Selectbylayer(dxf code f / ly)
- (setq ly(mapcar'(lambda(x)(cons(assoc 370(entget(tblobjname"layer"(cdadr x))))x))(STB"Layer"nil)))
- (ssget"X"(if code(append dxf(list(cons -4(strcat"<"f)))
- (vl-remove'nil(apply'append(mapcar'(lambda(x)(list'(-4 . "<or")x
- '(-4 . "<and")(assoc(car x)'((62 . 256)(6 . "Bylayer")))
- (cons 8(apply'strcat(mapcar'(lambda(x)(strcat(cdaddr x)","))
- (vl-remove-if-not'(lambda(y)(member x y))ly))))
- '(-4 . "and>")'(-4 . "or>")))code)))
- (list(cons -4(strcat f">"))))
- dxf)))
|