看了院长的程序,胡乱拼凑了一个程序,不要钱不要钱- (vl-load-com)
- (defun c:ttaa ()
- (setq xx (getreal "\n 请输入横向范围<5000>"))
- (if (not xx) (setq xx 5000))
- (setq yy (getreal "\n 请输入纵向范围<5000>"))
- (if (not yy) (setq yy 5000))
- (setq jd (getreal "\n 请输入旋转角度<-47.7>"))
- (if (not jd) (setq jd -47.7))
- (setq bl (getreal "\n 请输入缩放比例<0.41667>"))
- (if (not bl) (setq bl 0.41667))
- (setq i -1)
- (if (setq ss (ssget '((0 . "text"))))
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (setq ssbox (GetSSBoundingbox s1))
- (setq midpt (mapcar '(lambda (a b) (/ (+ a b) 2)) (car ssbox) (cadr ssbox)))
- (setq pt2 (list (- (car midpt) xx) (- (cadr midpt) yy) 0.0))
- (setq pt3 (list (+ (car midpt) xx) (+ (cadr midpt) yy) 0.0))
- (if (setq ss1 (ssget "w" pt2 pt3))
- (progn
- (setq ss1 (ssadd s1 ss1))
- (setq ssbox1 (GetSSBoundingbox ss1))
- (setq midpt1 (mapcar '(lambda (a b) (/ (+ a b) 2)) (car ssbox1) (cadr ssbox1)))
- (command ".rotate" ss1 "" midpt1 jd)
- (command ".Scale" "P" "" midpt1 bl)
- )
- )
- )
- )
- )
- (defun GetSSBoundingbox (sse / ss i ssn ll rr box ptlist ssbox)
- (if (= 'ENAME (type sse))
- (progn (setq ss (ssadd)) (ssadd sse ss))
- (setq ss sse))
- (if ss
- (progn
- (setq i -1)
- (repeat (sslength ss)
- (setq ssn (ssname ss (setq i (1+ i))))
- (vla-GetBoundingBox (vlax-ename->vla-object ssn) 'll 'rr) ;得到对象的包围盒
- (setq box (list (vlax-safearray->list ll) (vlax-safearray->list rr)))
- (setq ptlist (append ptlist box))
- )
- (setq ssbox (mapcar '(lambda (x) (apply 'mapcar (cons x ptlist))) (list 'min 'max)))
- )
- )
- )
|