本帖最后由 xyp1964 于 2024-1-13 10:20 编辑
- (defun c:tt ()
- "对象距离缩放(只改变对象距离位置,不改变对象大小)"
- (defun Ureal (bit kwd msg def / inp)
- (if def
- (setq msg (strcat "\n" msg "<" (rtos def 2) ">: ")
- bit (* 2 (fix (/ bit 2)))
- )
- (setq msg (strcat "\n" msg ": "))
- )
- (initget bit kwd)
- (setq inp (getreal msg))
- (if inp inp def)
- )
- (defun cen (s1 / x y a b)
- (vla-GetBoundingBox (vlax-ename->vla-object s1) 'a 'b)
- (mapcar '(lambda (x y) (* (+ x y) 0.5))(vlax-safearray->list a)(vlax-safearray->list b))
- )
- (defun ss2list (ss)
- (vl-remove-if-not'(lambda (x) (equal (type x) 'ENAME))(mapcar 'cadr (ssnamex ss)))
- )
- ;;
- (or sc (setq sc 2.))
- (setq sc (Ureal 7 "" "缩放比例" sc))
- (if (and (setq ss (ssget))
- (setq p0 (getpoint "\n缩放基点<退出>: "))
- )
- (setq lst (mapcar '(lambda (x)
- (setq p1 (cen x)
- dd (* (distance p0 p1) sc)
- p2 (polar p0 (angle p0 p1) dd)
- )
- (command "move" x "" "non" p1 "non" p2)
- )
- (ss2list ss)
- )
- )
- )
- (princ)
- )
|