cond和重复com帮助
我只是想知道怎么做。。(defun C:test (/)
(setq ss (ssget))
(command "_.erase" ss "")
(setq p1 (getpoint "\n**First point**"))
(setq p2 (getpoint p1 "\n**Second point**"))
(command "_.line" p1 p2 nil)
(setq opt (strcase (getstring "\NRepeat Last Command <Yes or No>: ")))
(cond((or(= opt "Y")(= opt "YES"))(prompt "\nrepeat last command"))
;;instead of prompting repeat last command I want it to actually repeat it
(T (prompt "\nExiting command"))
)
(princ)
) 这就是你想要实现的吗?
(defun c:Test (/ ss p1 p2)
(if (setq ss (ssget "_:L"))
(progn
(command "_.erase" ss "")
(while (and (setq p1 (getpoint "\nSpecify first point: "))
(setq p2 (getpoint p1 "\nSpecify second point: "))
)
(command "_.line" "_non" p1 "_non" p2 "")
)
)
)
(princ)
) 不确定你想重复哪一部分,但这里有一种方法。。。。
(defun C:test (/)
(setq ss (ssget))
(command "_.erase" ss "")
(setq wait T)
(while wait
(setq p1 (getpoint "\n**First point**"))
(setq p2 (getpoint p1 "\n**Second point**"))
(command "_.line" p1 p2 nil)
(initget 1 "Y N")
(setq opt (getkword "\nRepeat Last Command : "))
(if (eq "N" opt)
(setq wait nil)
)
)
(princ)
)
看起来你有。午饭后我会测试。 对于initget
使用
(initget 1 "Y N")
(setq opt (getkword "\nRepeat Last Command /No]: "))
而不是
(initget 1 "Y N")
(setq opt (getkword "\nRepeat Last Command or No]: "))
显示菜单(见附件)
好吧,我给!!
如何检索块旋转?
(setq ss (ssget "_:s" '((0 . "insert"))))
;;not really knowledgeable on assoc or car functions
;;I did find that rotation = 50
1) 检查有效的选择集:
(if (setq ss (ssget '((0 . "INSERT"))))
...
2) 迭代选择集:
最直观的可能是:
(setq counter 0)
(repeat (sslength ss)
(setq ent (ssname ss counter))
...
(setq counter (1+ counter))
)
3) 查询每个实体的旋转:
(cdr (assoc 50 (entget ent)))
谢谢你,先生 旋转是50吗?我得到了一些奇怪的角度。。。 它将以弧度为单位。
页:
[1]
2