entsel选择问题
<p>我现在想写一句,就是用entsel,想达到以下的效果,第一,用户选空,提示再选;</p><p>第二,选的必须是直线或只有两个点的多线段,如果用户选错,回到提示,还是不能选空,</p><p>就是必须选到对的东东时,才继续下面的程序。</p><p>大家指点一下,我想破了头。</p> (setq enobj (car (entsel "\nSelect Object:Line or Pline with to point, Press \"Esc\" to Exit:")))<br/>(while (null enobj) <br/>(setq enobj (car (entsel "\nNothing selected:Line or Pline with to point, Press \"Esc\" to Exit:")))<br/>)<br/>(setq endata (entget enobj))<br/>(while (or (and (/= (cdr (assoc 0 endata)) "LINE") (/= (cdr (assoc 0 endata)) "LWPOLYLINE")) (and (= (cdr (assoc 0 endata)) "LWPOLYLINE") (/= (cdr (assoc 90 endata)) 2)))<br/> (setq enobj (car (entsel "\nObject selected is unexpected, Line or Pline with to point again! Press \"Esc\" to Exit:")))<br/>(while (null enobj) <br/>(setq enobj (car (entsel "\nNothing selected:Line or Pline with to point, Press \"Esc\" to Exit:")))<br/>)<br/>(setq endata (entget enobj))<br/>) 对polyline没有考虑到 (defun tt (/ a en)(while (not (and
(setq a (car (entsel)))
(setq en (entget a))
(or (= (cdr (assoc 0 en)) "LINE")
(and (wcmatch (cdr (assoc 0 en)) "*POLYLINE")
(equal(vlax-curve-getendpoint a)(vlax-curve-getpointatparam a 1))
)
)
)
)
)
a
)
; 测试:(tt) <p>谢谢诸位的意见,学习了</p>
页:
[1]