youyou3810 发表于 2019-4-24 19:06:24

知道所有边长自动生成图形高人给实现思路

知道所有边长自动生成图形默认转角都是90度

youyou3810 发表于 2019-4-25 21:13:18

(defun c:tt ()
(setq p1 (getpoint "画图起始位置"))
(setq w (getdist "\n距离:"))
(setq jd (getdist "\n角度:1水平右 2水平左 3直角右 4直角左"))
(if (=1 jd 1)(setq jd 0))
(if (=2 jd 2)(setq jd 180))
(if (=3 jd 3)(setq jd 90))
(if (=4 jd 4)(setq jd -90))
(setq ang (* (/ jd 180) 3.1415926))
(setq p2 (polar p1 ang w))
(command "line" p1 p2 "")
(setq x 0)
(while (and (setq px p2)
              (setq w (getdist "\n距离:"))
              (setq jd (getdist "\n角度:"))
              (setq jd (getdist "\n角度:1水平右 2水平左 3直角右 4直角左"))
(if (=1 jd 1)(setq jd 0))
(if (=2 jd 2)(setq jd 180))
(if (=3 jd 3)(setq jd 90))
              (setq ang (* (/ jd 180) 3.1415926))
              (setq p2 (polar px ang w))
              (command "line" px p2 "")
       )
)
) 代码测试好像有点不行,没有找到问题

youyou3810 发表于 2019-4-24 19:44:08

youyou3810 发表于 2019-4-24 19:20
不能连续输入宽度及角度

(defun c:tt ()
(setq p1 (getpoint "画图起始位置"))

(setq w (getdist "\n距离:"))
(setq jd (getdist "\n角度:"))
(setq p2 (polar p1 jd w))
(command "line" p1 p2 "")
(function3 p2)
(defun function3 (px)
    (setq w (getdist "\n距离:"))
    (setq jd (getdist "\n角度:"))
    (setq p2 (polar px jd w))
    (command "line" px p2 "")
    (function3 p2)
)
) 代码有问题但是我觉得是这个思路

youyou3810 发表于 2019-4-24 20:23:08

(defun c:tt ()
(setq p1 (getpoint "画图起始位置"))

(setq w (getdist "\n距离:"))
(setq jd (getdist "\n角度:"))
(setq ang (* (/ jd 180) 3.1415926))
(setq p2 (polar p1 ang w))
(command "line" p1 p2 "")
(loop
    (setq px p2)
    (setq w (getdist "\n距离:"))
    (setq jd (getdist "\n角度:"))
    (setq ang (* (/ jd 180) 3.1415926))
    (setq p2 (polar px ang w))
    (command "line" px p2 "")
    )
)
现在循环出现了问题,看看怎么处理这个循环

youyou3810 发表于 2019-4-24 19:20:40

本帖最后由 youyou3810 于 2019-4-24 19:24 编辑

(defun c:tt ()
    (setq p1(getpoint"画图起始位置"))
   (setq w (getdist "\n距离:"))
(setq jd (getdist "\n角度:"))
(setq p2(polar p1 jd w))
(command "line" p1 p2 "")

)

不能连续输入宽度及角度

youyou3810 发表于 2019-4-24 19:59:30

(defun c:tt ()
(setq p1 (getpoint "画图起始位置"))

(setq w (getdist "\n距离:"))
(setq jd (getdist "\n角度:"))
(setq p2 (polar p1 jd w))
(command "line" p1 p2 "")
(loop
(setq px(p2))
    (setq w (getdist "\n距离:"))
    (setq jd (getdist "\n角度:"))
    (setq p2 (polar px jd w))
    (command "line" px p2 "")
)

(setq px(p2)) 这个赋值不成功,看看这个怎么赋值

youyou3810 发表于 2019-4-24 22:19:28

(defun c:tt ()
(setq p1 (getpoint "画图起始位置"))

(setq w (getdist "\n距离:"))
(setq jd (getdist "\n角度:"))
(setq ang (* (/ jd 180) 3.1415926))
(setq p2 (polar p1 ang w))
(command "line" p1 p2 "")
(setq x 0)
(while (and
    (setq px p2)
    (setq w (getdist "\n距离:"))
    (setq jd (getdist "\n角度:"))
    (setq ang (* (/ jd 180) 3.1415926))
    (setq p2 (polar px ang w))
    (command "line" px p2 "")
    ))
)
大功告成 {:1_1:}

13648893846 发表于 2019-4-24 23:03:18

角度如何判断

youyou3810 发表于 2019-4-25 00:31:05

目前 就是自己输入角度

mahuan1279 发表于 2019-4-25 08:53:20

如果转角都是90度,那就不用输入角度值。

mahuan1279 发表于 2019-4-25 08:55:55

youyou3810 发表于 2019-4-24 19:59
(setq px(p2)) 这个赋值不成功,看看这个怎么赋值

试试(setq px (list (car p2) (cadr p2)))
页: [1] 2
查看完整版本: 知道所有边长自动生成图形高人给实现思路