……,要不你让程序更好一下?
我不会:sleepy: LYC688 发表于 2023-5-3 19:53
应该可以指定选择X和y方向,这样好一些
liuhe 发表于 2023-5-2 21:07
不知道是不是你想要的
大师能不能改一下加上一个选项 按等距离排列的功能 ninja37 发表于 2023-5-18 22:19
大师能不能改一下加上一个选项 按等距离排列的功能
(defun c:JS(/ en enbox getenbox n p p1 p9 ss ty y ylst)
(defun getenbox(en / enbox py pz pzx)
(vla-getboundingbox(vlax-ename->vla-object en) 'minp 'maxp)
(setq pz(vlax-safearray->list minp))
(setq py(vlax-safearray->list maxp))
(setq pzx(mapcar '(lambda(X Y)(/(+ X Y)2))pz py))
(setq enbox(list pz py pzx))
enbox
)
(setvar "cmdecho" 0)
(command "undo" "be")
(setq os1 (getvar "osmode"))
(setvar "osmode" 1)
(if (= selcc nil) (setq selcc 10)) ;偏移距离初设 0
(setq cc1 (getdist (strcat "输入间距:<" (rtos selcc) ">")))
(if (= cc1 nil)(setq cc1 selcc )(setq selcc cc1))
(setvar "osmode" 0)
(setq ss(ssget))
(setq p(getpoint "\n选择排列起始点:"))
(setq ylst '())
(repeat(setq n(sslength ss))
(setq en(ssname ss(setq n(1- n))))
(setq enbox(getenbox en))
(if (= N nil)
(exit)
)
(setq p1(car enbox))
(setq p9(cadr enbox))
(setq y(-(cadr p9)(cadr p1)));---获取单个图元的Y长度
(setq ylst(append ylst (list (list y en (list (car p1) (cadr p9))))))
)
(setq ylst (vl-sort ylst '(lambda (x y) (< (car x) (car y)))))
(foreach tylst ylst
(setq y(car tylst))(print y)
(setq ty(cadr tylst))
(setq p1(caddr tylst))
(command "move" ty "" "non" p1 "non" p)
;(setq p(polar p 0.0 y))
(setq p(polar p (* pi 1.5) (+ y cc1)))
)
(setvar "osmode" os1)
(command "UNDO" "e")
(setvar "cmdecho" 1)
(princ)
)
页:
1
[2]