明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1875|回复: 4

entsel选择问题

[复制链接]
发表于 2007-6-16 09:07 | 显示全部楼层 |阅读模式

我现在想写一句,就是用entsel,想达到以下的效果,第一,用户选空,提示再选;

第二,选的必须是直线或只有两个点的多线段,如果用户选错,回到提示,还是不能选空,

就是必须选到对的东东时,才继续下面的程序。

大家指点一下,我想破了头。

发表于 2007-6-17 12:06 | 显示全部楼层
(setq enobj (car (entsel "\nSelect Objectine or Pline with to point, Press \"Esc\" to Exit:")))
(while (null enobj)
(setq enobj (car (entsel "\nNothing selectedine or Pline with to point, Press \"Esc\" to Exit:")))
)
(setq endata (entget enobj))
(while (or (and (/= (cdr (assoc 0 endata)) "LINE") (/= (cdr (assoc 0 endata)) "LWPOLYLINE")) (and (= (cdr (assoc 0 endata)) "LWPOLYLINE") (/= (cdr (assoc 90 endata)) 2)))
 (setq enobj (car (entsel "\nObject selected is unexpected, Line or Pline with to point again! Press \"Esc\" to Exit:")))
(while (null enobj)
(setq enobj (car (entsel "\nNothing selectedine or Pline with to point, Press \"Esc\" to Exit:")))
)
(setq endata (entget enobj))
)
发表于 2007-6-18 14:57 | 显示全部楼层
对polyline没有考虑到
发表于 2007-6-19 09:31 | 显示全部楼层
  1. (defun tt (/ a en)
  2.   (while (not (and
  3.   (setq a (car (entsel)))
  4.   (setq en (entget a))
  5.   (or (= (cdr (assoc 0 en)) "LINE")
  6.       (and (wcmatch (cdr (assoc 0 en)) "*POLYLINE")
  7.     (equal(vlax-curve-getendpoint a)(vlax-curve-getpointatparam a 1))
  8.       )
  9.   )
  10.        )
  11.   )
  12.   )
  13.   a
  14. )
  15. ; 测试:  (tt)
 楼主| 发表于 2007-6-30 16:16 | 显示全部楼层

谢谢诸位的意见,学习了

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-18 20:02 , Processed in 0.250033 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表