zkq1212 发表于 2014-7-8 15:07:04

请问一下这个循环怎么用右键退出

(defun C:t00 ()
(while t
(command "dimdiameter")
(while (/= (getvar "CMDACTIVE") 0) (command PAUSE))
)
(princ)
)

自贡黄明儒 发表于 2014-7-8 15:11:44

当while后面为nil时就退出了,你写成T当然不退出了

zkq1212 发表于 2014-7-8 15:38:43

本帖最后由 zkq1212 于 2014-7-8 15:44 编辑

自贡黄明儒 发表于 2014-7-8 15:11 static/image/common/back.gif
当while后面为nil时就退出了,你写成T当然不退出了
当while后面为nil时就直接退出了,一次都不执行了。我想可以重复标注圆,也就是下面程序的效果
(defun c:33 ()
(setq clay (getvar "clayer"))
(command "Layer" "s" "03-标注层" "")
(while (setq p(entsel "\n指定新的标注:"))
(command"dimdiameter")(getvar"cmdactive")(command p)
    (while(/=(getvar"cmdactive")0)(command pause))
)
(command "Layer" "s" clay "")
(princ)
)

zkq1212 发表于 2014-7-8 15:52:47

(defun C:t00 ()
(setq      ent (entlast)
      key t
)

(while key
(command "dimdiameter")

;(while (/= (getvar "CMDACTIVE") 0) (command PAUSE))
)
(princ)
)
那么变量如何判断鼠标右键?

lyqiezi 发表于 2014-7-8 22:10:32

为什么要用entlast?
如果使用
(while (setq ent(entsel))
(commmand……
)怎样?

ZZXXQQ 发表于 2014-7-9 08:18:33

(defun c:tt ()
(setvar "CMDECHO" 0)
(while (and (setq s1 (entsel "\n选择圆: "))
                  (wcmatch (cdr(assoc 0 (entget(car s1)))) "ARC,CIRCLE"))
(command "_.DIMDIAMETER" s1)
(while (> (getvar "CMDACTIVE") 0) (command PAUSE))
)
(princ)
)
页: [1]
查看完整版本: 请问一下这个循环怎么用右键退出