lisp中的最后一点
你好我对Lisp程序很陌生
我今天才开始看
我想知道如何使用最后选择的点
我画了一条很简单的线,但我如何再选择一个点,它从第一条线的末端画一条线到新的点,并对任意数量的点继续这样做
谢谢你的帮助
如果我没有很好地解释,我将张贴我到目前为止 嗯,有几种方法可以实现这一点:
最简单的是:
(command "_line")
(while (> (getvar "CMDACTIVE") 0) (command pause))
但要仅检索最后单击的点:
(getvar "lastpoint")
再看看getpoint
(setq P1 (getpoint "\npick a point: ")) thanx lee max公司
这正是我想要的
现在唯一的事情是,除非我按esc键,否则我的命令不会完成(当我按return键时,它不会完成)。对此,我们将不胜感激 你可以发布你的例程吗?我会检查错误-如果按enter键,我发布的代码应该会停止。 由于某些原因,我无法将其作为附件发布。我的工作电脑不允许我发布,但这是我的文本
(defun c:3点()
; 定义函数
(setq a(getpoint“\n输入第一个点:”)
; 获得第一分
(setq b(getpoint“\n输入下一个点:”)
;获得第二点
(命令行“a b”)
;划清界限
(虽然
(setq c(getvar“lastpoint”))
(setq d(getpoint“\n输入下一个点:”)
(命令行“c d”)
;划清界限
)
(普林斯)
;清洁运行
) ;结束defun
(普林斯)
;清洁装载
顺便说一句,这样做的原因是要学习一些关于lisps的知识,但目前实际上并不实用(因此它基本上是一个行命令) 我只想把它简化为:
(defun c:3point ()
(command "_line")
(while (> (getvar "CMDACTIVE") 0)
(command pause))
(princ))
非常感谢lee mac
有一件事,你能解释一下嘴唇的“while”部分和“command pause”吗?因为我不知道它们在做什么,我的目标是能够自己写。
thanx又是一个伟大的洞察力,我有很多我不需要的东西 没问题-如果你还有问题,尽管问
(defun c:3point ()
; Define the Function - no local variables or arguments in this one, so nothing in the brackets
(command "_line")
; Invoke the Line command (merely prints "line" to the command line.
(while
; While the following is true
(> (getvar "CMDACTIVE") 0)
; The variable "CMDACTIVE" determines whether a command is active or not, i.e, while the line command
; is active...
(command pause))
; print a "pause" to the command line (hence pause for user input.
(princ))
;; exit cleanly.
只是出于对这件事的兴趣
命令如何处于非活动状态
当然,如果它不活动,它不会做任何事情??
thanx公司
页:
[1]
2