这是我用的,不过不支持布局空间
- ;;变换(UCS)用户坐标系
- (defun C:xz (/ ro_ang)
- (princ (strcat "\n输入角度或指定视口绕 Z 轴的旋转角度(默认为恢复视图): "))
- (setq ang (getangle))
- (defun xzst (ro_ang / )
- (setvar "cmdecho" 0)
- (if (equal (getvar "TILEMODE") 1)
- (progn
- (command "_.undo" "_group")
- (setq viewcenter (getvar "VIEWCTR")
- viewsize (getvar "VIEWSIZE")
- zoom1 (polar viewcenter (* pi 0.5) viewsize)
- zoom2 (polar viewcenter (* pi 3.5) viewsize)
- zoom1 (trans zoom1 1 0)
- zoom2 (trans zoom2 1 0)
- )
- (command "_.ucs" "_Z" (angtos ro_ang 0 8))
- (command "_.Plan" "")
- (command "zoom" "w" (trans zoom1 0 1) (trans zoom2 0 1))
- (command "_.undo" "_end")
- )
- (princ "\n*请切换到模型空间*")
- )
- (princ)
- )
- (if ang
- (xzst ang)
- (progn
- (setvar "cmdecho" 0)
- (if (equal (getvar "TILEMODE") 1)
- (progn
- (command "_.undo" "_group")
- (setq viewcenter (getvar "VIEWCTR")
- viewsize (getvar "VIEWSIZE")
- zoom1 (polar viewcenter (* pi 0.5) viewsize)
- zoom2 (polar viewcenter (* pi 3.5) viewsize)
- zoom1 (trans zoom1 1 0)
- zoom2 (trans zoom2 1 0)
- )
- (command "_.Plan" "w" "_.ucs" "w")
- (command "zoom" "w" (trans zoom1 0 1) (trans zoom2 0 1))
- (command "_.undo" "_end")
- )
- (princ "\n*请切换到模型空间*"))
- (princ))))
|