【发布时间】:2021-04-21 16:04:49
【问题描述】:
我正在尝试遍历一些矩形并将 x 和 y 坐标分别放在一个列表中。但是我要填写的列表看起来很糟糕,代码:
(setq sspnls (ssget '((0 . "LWPOLYLINE"))))
(while (= 1 (getvar 'cmdactive))
(command pause)
)
(setq pnlslength (sslength sspnls))
(setq xlist (list))
(setq ylist (list))
(setq pnlname(ssname sspnls 0))
(setq sssort (ssadd))
(setq tllr 0)
(while (< tllr pnlslength)
(setq pnlname(ssname sspnls tllr))
(Command "hatch" "S" pnlname "")
(setq xs (cadr (assoc 10 (entget pnlname)))); y cordinate
(setq ys (caddr (assoc 10 (entget pnlname)))); x cordinate
(setq xlist (cons xlist xs))
(setq ylist (cons ylist ys))
(setq tllr (+ tllr 1))
);while end
xlist 或 y 列表如下:
((((nil . 12057.63625954) . 12057.63625954) . 10345.63625954) . 10345.63625954)
我需要它看起来像:
(12057.63625954 12057.63625954 10345.63625954 10345.63625954)
我做错了什么?请注意,我使用的是 Draftsight,我也使用了 append 函数,但 append 函数根本不起作用?
非常感谢您的帮助!
【问题讨论】: