CAD多对象以中心缩放

(defun C:tes ( / #os1 #r1 &k1 &kw1 &ob1 pt1)
(vl-load-com)
(setq #os1 (getvar "osmode"))
(if (and (setq &kw1 (ssget));如果只是选择圆的话(ssget '((0 . "CIRCLE")))替换(ssget)
(setq #r1 (getdist "\n请输入缩小或放大倍数"))
(> #r1 0)
)
(progn
(setvar "osmode" 0)
(while (setq &k1 (ssname &kw1 0))
(setq &kw1 (ssdel &k1 &kw1))
(setq &ob1 (vlax-ename->vla-object &k1))
(setq pt1 (lsp201510026 &ob1))
(vla-ScaleEntity &ob1 pt1 #r1)
)
(setvar "osmode" #os1)
)
)
(princ)
);复制到记事本,以【.lsp】为后缀命名,打开CAD,autolisp加载,命令【TES】
;包围盒中心点放大缩小对象;圆的中心点也就是圆心

;;;;;;;;;;;;;
;包围盒中心点
;;;;;;;;;;;;;
(defun lsp201510026 (&ob1 / &ob1 pt1 pt2 x)
(vla-GetBoundingBox &ob1 'pt1 'pt2)
(setq pt1 (Vlax-SafeArray->List pt1) pt2 (Vlax-SafeArray->List pt2))
(setq pt1 (mapcar '(lambda (x) (* x 0.5)) (mapcar '+ pt1 pt2)))
(vlax-3d-Point pt1)
)

你可能感兴趣的:(CAD多对象以中心缩放)