thalon 发表于 2016-7-15 19:13:11

求一个图层过滤功能,求大神帮忙,谢谢

下面代码可以将选择的图元移至指定图层(图层信息存在的前提下),
现在我希望增加一个功能,

在移至指定图层的时候过滤指定的其它图层,怎么把下面图层过滤代码加进去,求大神帮忙,谢谢


图层过滤
(setq ss (ssget(list '(-4 . "<not")(cons 8 layer)'(-4 . "not>"))));;;-------------------------------------------------------------------------------------------------------------------
;;;★改图元图层
;;;By print1985 明经社区
;;;-------------------------------------------------------------------------------------------------------------------
(vl-load-com)
;冷水
(defun c:sw()(gtc "SP_W"))
(defun c:sj()(gtc "SJ_J"))
(defun c:sjs()(gtc "SJ_JS"))
(defun c:sj1()(gtc "SJ_J1"))
(defun c:sj2()(gtc "SJ_J2"))
(defun c:sj3()(gtc "SJ_J3"))
(defun c:sj4()(gtc "SJ_J4"))
(defun c:sj5()(gtc "SJ_J5"))
(defun c:sjl()(gtc "SJSTK"))
(defun c:sjb()(gtc "SJBLK"))
(defun c:sj5()(gtc "SJ_J5"))

;;;此处省略若干行类似上面的语句!!!

(defun gtc (tcm /ss k ent obj);改图层子程序
(if (setq ss (ssget))
   (progn
    (setq k 0)
    (repeat (sslength ss)
   (setq ent (ssname ss k))
   (setq obj (vlax-ename->vla-object ent))
   (vla-put-layer obj tcm)
   (setq k (1+ k))
    )
))
(princ)
)

thalon 发表于 2016-7-16 07:38:22

不要沉啊,大神帮帮忙

w245272914 发表于 2017-9-4 10:10:40

帮你顶让大家看到

305341043 发表于 2017-9-4 10:33:52

强烈支持,

llsheng_73 发表于 2017-9-5 08:54:21

(setq ss (ssget(list '(-4 . "<not")(cons 8 layer)'(-4 . "not>"))));;与下一句同样效果
(setq ss(ssget(list(cons 8(strcat"~"layer)))))

(defun gtc (tcm /ss);改图层子程序
(if(setq ss(ssget(list(cons 8(strcat"~"tcm)))))
    (command"chprop"ss"""la"tcm"")
    )
)
页: [1]
查看完整版本: 求一个图层过滤功能,求大神帮忙,谢谢