求竖排变横排的程序或者思路
本帖最后由 偏爱云~小吴 于 2015-5-30 14:00 编辑求将附件所示的图竖排变横排的法子,求大神出手。图框是块,切块名不一致。
;;87.1 [功能] 包围对象最小最大点列表
;; 示例: (MJ:GetBoundingBox (car (entsel)))
;; 返回: ((左下角点)(右上角点))
(defun MJ:GetBoundingBox (ent / ll ur)
(vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur)
(mapcar 'vlax-safearray->list (list ll ur))
)
;;; 编制:USER2128 于 2015-05-30
(defun c:tt ()
(setq Lst '())
(while (setq en (entsel "\n按先后顺序点取输入框块/<完成>:"))
(setq en (MJ:GetBoundingBox (car en)))
(setq Lst (append Lst (list en)))
)
(or (initget 6)
(setq dst (getdist "\n输入要排列各图间间距/<30>:"))
(setq dst 30.0)
)
(or (setq pt (getpoint "\n横向排列图的左下点/<0,0,0>:"))
(setq pt '(0 0 0))
)
(mapcar '(lambda(x)
(setq ss (ssget "_c" (car x) (cadr x)))
(vl-cmdf "_.copy" ss "" (car x) pt)
(setq pt (mapcar '+ pt (list (+ (- (caadr x) (caar x)) dst) 0 0)))
) Lst)
(princ)
)
页:
[1]