| 
UID643640积分26精华贡献 威望 活跃度 D豆 在线时间 小时注册时间2008-8-9最后登录1970-1-1 
 | 
 
| 
功能: 1.带提示和过滤表的entsel;
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册 
    2.循环直到选中有效实体或选择退出为止;
 论坛以前也有相关贴子,方法略有不同,借鉴前辈的一些思路,尽供参考.
 (defun c:fssel (/ filter_check na)
 (setq msg "\nSelect touching object: ")
 (setq flt '((0 . "TEXT") (8 . "beam")
 (40 . 600.0)(62 . 4)
 )
 ) ;local function
 (defun filter_check (na flt / e1 a n flag)
 (cond
 ((not na)
 (setq flag nil)
 )
 ((not flt)
 (setq flag T)
 )
 (T
 (setq e1 (entget na));setq
 (setq n 0)
 ;(setq flag t)
 (while (and
 (not flag)
 (< n (length flt))
 );and
 (setq a (nth n flt));setq
 ;setq then got a match for the filter
 (if (not (member a e1))(setq n (length flt)))
 (if (and (member a e1)(= n (-(length flt )1)))(setq flag t)) ;if
 
 (setq n (+ n 1));setq
 );while
 )
 );cond close
 flag
 );defun filter_check
 (if (not (equal (substr msg 1 1) "\n"))
 (setq msg (strcat "\n" msg))
 );if
 (while (not na)
 (setvar "errno" 0)
 (while (or
 (and
 (not (setq na (car (entsel msg))))
 (equal 7 (getvar "errno"))
 );and
 (and
 na
 (not (filter_check na flt))
 );and
 );or
 (if (equal 7 (getvar "errno"))
 (princ "\n0 found")
 (progn
 (if na
 (princ (strcat "\n*Invalid select*  "
 );strcat
 );princ
 );if
 );progn
 );if
 (setvar "errno" 0)
 );while
 (cond
 ((equal (getvar "errno") 52) ;enter
 (setq na 99);
 )
 );cond close
 );while
 (if (equal na 99)
 (setq na nil)
 )
 na
 )
 | 
 |