youyou3810 发表于 2019-5-2 08:18:50

setq p1 (getpoint 监视值为啥没有是nil

(defun c:tt (/ w h p1 p2 ang)
(setq l1 5)      ;长度
(setq p1 (getpoint "第一点:"))
(setq p2 (getpoint "\n**第二点:"))
(setq p3 (getpoint "方向"))
)

为啥p1,p2都是空值

youyou3810 发表于 2019-5-2 09:03:51


(defun LM:Clockwise-p ( p1 p2 p3 )
    ((lambda ( n ) (< (car (trans p2 0 n)) (car (trans p1 0 n)))) (mapcar '- p1 p3))
)
由于p1 p2是空值 无法判断方向
(if (= (LM:Clockwise-p p1 p2 p3) nil);

Andyhon 发表于 2019-5-2 09:09:30

叙述不全

... (/ w h p1 p2 ang)...

猜是您原先P3有值
但进程序后 p1 p2 会被清空...

youyou3810 发表于 2019-5-2 09:16:41

本帖最后由 youyou3810 于 2019-5-2 09:39 编辑

Andyhon 发表于 2019-5-2 09:09
叙述不全

... (/ w h p1 p2 ang)...

你说的没错 我把那些参数都去掉了 现在有值了

youyou3810 发表于 2019-5-2 09:39:21

本帖最后由 youyou3810 于 2019-5-2 09:50 编辑

(defun c:tt ()
(setq l1 5)      ;长度
(setq p1 (getpoint "第一点:"))
(setq p2 (getpoint p1 "\n**第二点:"))
(setq p3 (getpoint p2 "\n**第二点:"))
(setq ang1 (angle p1 p2))    ;角度
(setq ll1 (distance p1 p2))    ;长度

(defun LM:Clockwise-p(p1 p2 p3)
    ((lambda (n) (< (car (trans p2 0 n)) (car (trans p1 0 n))))
      (mapcar '- p1 p3)
    )
)
(if (= (LM:Clockwise-p p1 p2 p3) nil)
   (
    (command "circle" p1 2)
   (command "circle" p2 2)
   (command "circle" p3 2)
      )
)

)代码修正一下

烟盒迷唇 发表于 2019-5-2 22:20:56

局部变量过了就没值了,弄成全局变量
页: [1]
查看完整版本: setq p1 (getpoint 监视值为啥没有是nil