点转成阵列点表
假设我有一个基点,我想阵列一些点表,如何写呢?变量的话,可以给行个数,列个数,行距,列距,这四个变量。
;;;_$ (ttt '(0 0) 10 10 1 1)
;;; ((0 0) (1 0) (2 0) (3 0) (4 0) (5 0) (6 0) (7 0) (8 0) (9 0)
;;;(0 1) (1 1) (2 1) (3 1) (4 1) (5 1) (6 1) (7 1) (8 1) (9 1)
;;;(0 2) (1 2) (2 2) (3 2) (4 2) (5 2) (6 2) (7 2) (8 2) (9 2)
;;;(0 3) (1 3) (2 3) (3 3) (4 3) (5 3) (6 3) (7 3) (8 3) (9 3)
;;;(0 4) (1 4) (2 4) (3 4) (4 4) (5 4) (6 4) (7 4) (8 4) (9 4)
;;;(0 5) (1 5) (2 5) (3 5) (4 5) (5 5) (6 5) (7 5) (8 5) (9 5)
;;;(0 6) (1 6) (2 6) (3 6) (4 6) (5 6) (6 6) (7 6) (8 6) (9 6)
;;;(0 7) (1 7) (2 7) (3 7) (4 7) (5 7) (6 7) (7 7) (8 7) (9 7)
;;;(0 8) (1 8) (2 8) (3 8) (4 8) (5 8) (6 8) (7 8) (8 8) (9 8)
;;;(0 9) (1 9) (2 9) (3 9) (4 9) (5 9) (6 9) (7 9) (8 9) (9 9))
(defun ttt (Insert x y dx dy / ret Vx Vy m n)
(setq ret nil)
(setq m 0)
(setq Vy (cadr Insert))
(while (< m y)
(setq n 0)
(setq Vx (car Insert))
(while (< n x)
(setq ret (cons (list Vx Vy) ret))
(setq n (1+ n))
(setq Vx (+ Vx dx))
)
(setq m (1+ m))
(setq Vy (+ Vy dy))
)
(reverse ret)
)
(defun abc (pt nx ny dx dy / ptn tmp p0)
"点阵列"
;; (abc '(0 0) 10 10 1 1)
(setq p0 pt)
(repeat ny
(setq ptn '())
(repeat nx
(setq ptn (cons pt ptn)
pt (polar pt 0 dx)
)
)
(setq tmp (cons (reverse ptn) tmp)
p0(polar p0 (* pi 0.5) dy)
ptp0
)
)
(reverse tmp)
) (defun ptlst (p0 xn yn xd yd / i ii plst px)
(setq plst '())
(setq i -1)
(repeat xn (setq plst (cons (setq px (polar p0 (* 0 pi) (* (setq i (1+ i)) xd))) plst))
(setq ii 0)
(if (/= yn 1)
(repeat (1- yn) (setq plst (cons (polar px (* 0.5 pi) (* (setq ii (1+ ii)) yd)) plst))));re2
);re1
plst
) 两层while循环 polar算点 copy复制 (或vla-Copy复制后 vla-Move移动) 飞雪神光 发表于 2024-5-15 17:25
两层while循环 polar算点 copy复制 (或vla-Copy复制后 vla-Move移动)
我意思是通过表操作来转换。 polar计算点坐标加入表保存,关键要确定基础点的位置,左上?右下?中间?之后点表的排列顺序? start4444 发表于 2024-5-15 17:57
polar计算点坐标加入表保存,关键要确定基础点的位置,左上?右下?中间?之后点表的排列顺序?
都无所谓,默认左下吧 vlisp好像有阵列函数啊 vla-ArrayRectangular vla-ArrayPolar 如果没有实体点 就 ploar 或者向量计算
页:
[1]
2