根据大家的群策群力,总结下此贴代码,我加了些系统变量控制,因为要保证此4个命令的顺利进行,需要关闭捕捉与正交的!- ;;----------------------------------------------------------------------------
- (defun SSET( )
- (setq oldos (getvar "OSMODE"))
- (setq oldorh (getvar "ORTHOMODE"))
- (setq oldsn (getvar "SNAPMODE"))
- (setvar "OSMODE" 0) ;;;捕捉关闭
- (setvar "ORTHOMODE" 0) ;;;正交关闭
- (setvar "SNAPMODE" 0);;;;实体捕捉关闭
- (setvar "CMDECHO" 0)
- (setvar "TEXTEVAL" 1)
- )
- ;;---------------------------------------------------------------------------
- (defun SSET1( )
- (setvar "ORTHOMODE" oldorh) ;;;恢复正交
- (setvar "OSMODE" oldos) ;;;恢复正交
- (setvar "SNAPMODE" oldsn) ;;;;恢复实体捕捉
- (setvar "CMDECHO" 1)
- )
- ;;----------------------------------------------------------------------------
- (defun C:H-MR-MV (/ s pt2 pt3)
- (command)
- (SSET)
- (if (setq s(ssget))
- (progn
- (setq pt2 (nth 1(grread 5)))
- (setq pt3 (polar pt2 (* 0.5 pi) 2.5))
- (command "mirror" s "" pt2 pt3 "y" "move" "p" "" pt3 pause)
- )
- )
- (SSET1)
- (princ)
- )
- ;;---------------------------------------------------------------------------
- (defun C:V-MR-MV (/ s pt2 pt3)
- (command)
- (SSET)
- (if (setq s(ssget))
- (progn
- (setq pt2 (nth 1(grread 5)))
- (setq pt3 (polar pt2 0 2.5))
- (command "mirror" s "" pt2 pt3 "y" "move" "p" "" pt3 pause)
- )
- )
- (SSET1)
- (princ)
- )
- ;;------------------------------------------------------------------------------
- (defun C:H-MR-MV-N (/ s ss s1 pt2 pt3)
- (command)
- (SSET)
- (if (setq s(ssget))
- (progn
- (setq pt2 (nth 1(grread 5)))
- (setq pt3 (polar pt2 (* 0.5 pi) 2.5))
- (setq s1 (entlast) ss (ssadd))
- (command "MIRROR" s "" PT2 pt3 "N")
- (while (setq s1 (entnext s1))
- (ssadd s1 ss)
- )
- (command "MOVE" ss "" PT3 PAUSE)
- ))
- (SSET1)
- (princ)
- )
- ;;------------------------------------------------------------------------------
- (defun C:V-MR-MV-N (/ s ss s1 pt2 pt3)
- (command)
- (SSET)
- (if (setq s(ssget))
- (progn
- (setq pt2 (nth 1(grread 5)))
- (setq pt3 (polar pt2 0 2.5))
- (setq s1 (entlast) ss (ssadd))
- (command "MIRROR" s "" PT2 pt3 "N")
- (while (setq s1(entnext s1))
- (ssadd s1 ss)
- )
- (command "MOVE" ss "" PT3 PAUSE)
- ))
- (SSET1)
- (princ)
- )
|