简化阵列
本帖最后由 GDFGFGF 于 2020-12-10 17:08 编辑麻烦哪位大神帮忙优化下,感激不尽
简化阵列
(defun c:rrR(/ *hang2 *jj2 *lie2 a1 ab1 b1 ss xlen ylen)
(setq ss (ssget))
(setq ab1 (box ss) a1 (car ab1) b1 (cadr ab1))
(setq xlen (abs (- (car b1) (car a1))))
(setq ylen (abs (- (cadr b1) (cadr a1))))
(if (not *hang)(setq *hang 1))
(setq *hang (if (setq *hang2 (getint (strcat "\n输入行数:<" (itoa *hang) ">:"))) *hang2*hang))
(if (not *lie)(setq *lie 1))
(setq *lie (if (setq *lie2 (getint (strcat "\n输入列数:<" (itoa *lie) ">:"))) *lie2 *lie))
(if (not *jj)(setq *jj 100))
(setq *jj (if (setq *jj2 (getdist (strcat "\n输入间距:<" (rtos *jj 2 2) ">:"))) *jj2 *jj))
(command "ARRAY" ss "" "r" *hang *lie (+ ylen *jj) (+ xlen *jj))
;(princ)
)
按x轴阵列是没有问题但是按Y轴阵列就会出现重叠的现象 999999 发表于 2020-12-11 08:39
支持一下,,,有心无力
(defun c:rr (/ *hang2 *jj2 *lie2 a1 ab1 b1 ss xlen ylen)
(setq ss (ssget))
(setq ab1 (box ss) a1 (car ab1) b1 (cadr ab1))
(setq xlen (abs (- (car b1) (car a1))))
(setq ylen (abs (- (cadr b1) (cadr a1))))
(if (not *hang)(setq *hang 1))
(setq *hang (if (setq *hang2 (getint (strcat "\n输入行数:<" (itoa *hang) ">:"))) *hang2*hang))
(if (not *lie)(setq *lie 1))
(setq *lie (if (setq *lie2 (getint (strcat "\n输入列数:<" (itoa *lie) ">:"))) *lie2 *lie))
(if (not *jj)(setq *jj 100))
(setq *jj (if (setq *jj2 (getdist (strcat "\n输入间距:<" (rtos *jj 2 2) ">:"))) *jj2 *jj))
(if (= 1 *hang) (command "ARRAY" ss "" "r" *hang *lie (+ xlen *jj)) (command "ARRAY" ss "" "r" *hang *lie (+ ylen *jj) (+ xlen *jj)))
;(princ)
)
;;;;;单个图元包围盒
(defun eBox (ent / ll ur)
(vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur)
(mapcar 'safearray-value (list ll ur))
)
;;;;;;;;;;
;;;;;;;;;;
;;;;;求点集中最小和最大点
(defun minmax(plist)
(list (apply 'mapcar (cons 'min plist))
(apply 'mapcar (cons 'max plist)))
)
;;(mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list plist plist))
;;;;;选择集最大包围盒
(defun box(ss / i en plist pt1 pt2 a b ab)
(setq plist '() i -1)
(repeat (sslength ss)
(setq i(1+ i) en (ssname ss i))
(setq box1(ebox en) pt1(car box1) pt2(cadr box1))
(setq plist(cons pt1 plist) plist(cons pt2 plist))
)
(minmax plist)
) 本帖最后由 999999 于 2020-12-11 10:57 编辑
GDFGFGF 发表于 2020-12-11 10:26
你还有什么好用的程序不,交换下
我的都是在明经里面找到,还有就是E派工具箱+加贱人+燕秀+mini建筑工具+春婵,就是想实现的功能太散了 支持一下,,,有心无力 999999 发表于 2020-12-11 08:39
支持一下,,,有心无力
已经好了,你要不要:lol 999999 发表于 2020-12-11 08:39
支持一下,,,有心无力
自己复制出去,加载到CAD就行
GDFGFGF 发表于 2020-12-11 09:03
(defun c:rr (/ *hang2 *jj2 *lie2 a1 ab1 b1 ss xlen ylen)
(setq ss (ssget))
(setq ab1 (box ss)...
牛批呀,,,用了一下,真爽 GDFGFGF 发表于 2020-12-11 09:04
自己复制出去,加载到CAD就行
谢谢啦,,对了,,你有没有用LSP加载外部插件的代码,,,,突然想试一下 999999 发表于 2020-12-11 09:13
谢谢啦,,对了,,你有没有用LSP加载外部插件的代码,,,,突然想试一下
高深的不会:lol 999999 发表于 2020-12-11 09:12
牛批呀,,,用了一下,真爽
你还有什么好用的程序不,交换下:lol