本帖最后由 表骑马实开车 于 2023-3-8 11:40 编辑
- (vl-load-com)
- (defun c:tt (/ os ss box ssmid p3)
- (setq os (getvar "osmode"))
- (setvar "cmdecho" 0)
- (setvar "osmode" 0)
- (if (setq ss (ssget))
- (progn
- (setq box (LM:ssboundingbox ss)
- ssmid (mapcar '*
- (mapcar '+ (car box) (cadr box))
- '(0.5 0.5 0.5)
- )
- p3 (polar ssmid (* 1.5 pi) 10)
- )
- (command "mirror" ss "" ssmid p3 "y")
- )
- )
- (setvar "osmode" os)
- (setvar "cmdecho" 1)
- (princ)
- )
- ;; 选择集边界框 - Lee Mac
- ;; 返回一个列表的左下角和右上角的 WCS 坐标
- ;; 包围提供的选择集中所有对象的矩形框。
- ;; sel - [sel] 返回边界框的选择集
- (defun LM:ssboundingbox (sel / idx llp ls1 ls2 obj urp)
- (repeat (setq idx (sslength sel))
- (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
- (if (and (vlax-method-applicable-p obj 'getboundingbox)
- (not (vl-catch-all-error-p
- (vl-catch-all-apply
- 'vla-getboundingbox
- (list obj 'llp 'urp)
- )
- )
- )
- )
- (setq ls1 (mapcar 'min
- (vlax-safearray->list llp)
- (cond (ls1)
- ((vlax-safearray->list llp))
- )
- )
- ls2 (mapcar 'max
- (vlax-safearray->list urp)
- (cond (ls2)
- ((vlax-safearray->list urp))
- )
- )
- )
- )
- )
- (if (and ls1 ls2)
- (list ls1 ls2)
- )
- )
一个旋转180° ,一个是旋转0°才能达到要求 |