autolisp如何实现快速选择满足条件的对象
本帖最后由 275437962 于 2013-12-27 22:31 编辑链接地址: http://bbs.mjtd.com/thread-108797-1-1.html
http://bbs.mjtd.com/thread-108829-1-1.html 2楼 本帖最后由 SunSpring 于 2013-12-28 10:04 编辑
借花献佛,试试看是不是这样.
(defun myss (minl maxl / e len n obj ss)
(if (setq ss (ssget '((0 . "*LINE"))))
(repeat (setq n (sslength ss))
(setq e (ssname ss (setq n (1- n))))
(setq obj (vlax-ename->vla-object e))
(setq len (vlax-get obj 'length))
(if (or
(< len minl)
(> len maxl)
)
(ssdel e ss)
)
)
)
ss
)
(defun c:sss (/ a b ss)
(if (not (setq a (getdist "\n请指定最小长度<0.5>:")))
(setq a 0.5)
)
(if (not (setq b (getdist "\n请指定最大长度<2.5>:")))
(setq b 2.5)
)
(if (and
a
b
)
(if (setq ss (myss a b))
(command "._select" ss "" "._pselect" ss "")
)
)
(princ)
)
难道选择易实现不了么? 本帖最后由 SunSpring 于 2013-12-28 21:45 编辑
我觉着有失公平,那个函数有过lisp经验的都能写的出,只是偷懒没再去写一遍,最后竟是如此。。。。
最终明白你意思是我,而不是那个程序。
页:
[1]