-
- ;;http://bbs.mjtd.com/thread-183496-1-1.html
- (defun c:tt (/ cmde lst p1 ss ss1)
- (setq cmde (getvar "CMDECHO"))
- (setvar "CMDECHO" 0)
- (prompt "\n框选需要合并的表格:")
- (while (setq ss (ssget))
- (setq lst (reverse (wyb-get-box ss)))
- (setq p1 (caar lst) lst (cdr lst))
- (if (/= lst nil)
- (foreach x lst
- (setq ss1 (ssget "w" (car x) (cadr x)))
- (vl-cmdf "_.move" ss1 "" "non" (list (caar x) (cadadr x)) "non" p1)
- (setq p1 (polar p1 (* 1.5 pi) (distance (car x) (list (caar x) (cadadr x)))))
- )
- (prompt "\n没有需要合并的表格。")
- )
- (prompt "\n框选需要合并的表格:")
- )
- (setvar "CMDECHO" cmde)
- (prompt "\n表格合并完成!")
- (princ)
- )
- ;|= 4.2. 取得图元外矩形框
- ;@== (wyb-get-box ename)
- ;#== return: [plst]'((x1 y1 z1)_min (x2 y2 z2)_max)
- ;ver:
- ; [1.0] 乐筑天下 Longxin, Gu_xl&邹锋
- ; [1.1] by woyb 20151010
- ; [1.1.1] ADD: 释放obj by woyb 20180730
- ;====================|;
- (defun wyb-get-box (@e / p1 p2 p3 p4 obj lst tmp)
- (setq obj (vlax-ename->vla-object @e))
- (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'p1 'p3))))
- (progn
- (setq p1 (vlax-safearray->list p1)
- p3 (vlax-safearray->list p3)
- p2 (list (car p1) (cadr p3) (caddr p1))
- p4 (list (car p3) (cadr p1) (caddr p1))
- )
- (if (= "SPLINE" (cdr (assoc 0 (entget @e))))
- (progn
- (setq lst
- (mapcar '(lambda (a b) (vlax-curve-getClosestPointToProjection @e a b t))
- (list p1 p2 p3 p4)
- '((1.0 0 0) (0 -1.0 0) (-1.0 0 0) (0 1.0 0))
- )
- )
- (setq tmp
- (list
- (apply 'mapcar (cons 'min lst))
- (apply 'mapcar (cons 'max lst))
- )
- )
- )
- (setq tmp (list p1 p3))
- )
- )
- (setq tmp nil)
- )
- (vlax-release-object obj)
- tmp
- )
|