本帖最后由 xinxirong 于 2017-10-17 19:26 编辑
 - ;;;第一个旋转视图 by ucuc2003
- (defun XZST (ro_ang / )
- (setvar "cmdecho" 0)
- (princ "旋转模型空间的视图")
- (if (equal (getvar "TILEMODE") 1)
- (progn
- (command "_.undo" "_group")
- (command "_.ucs" "_Z" (angtos ro_ang 0 8))
- (command "_.Plan" "")
- (command "_.undo" "_end")
- )
- (princ "\n*请切换到模型空间*")
- )
- (princ)
- )
- ;;;旋转视图end
- ;;;第二恢复视图 保存全局变量old_ro_ucs_z_ang
- (defun C:ST (/ ro_ang)
- ;;记忆参数old_ro_ucs_z_ang (这个值在本LSP文件内必须唯一,不能有重名的)
- (if (= old_ro_ucs_z_ang nil) (setq old_ro_ucs_z_ang (/ pi 2)))
- (if ro_ang (setq old_ro_ucs_z_ang ro_ang)(setq ro_ang old_ro_ucs_z_ang))
- (princ (strcat "\n指定视口绕 Z 轴的旋转角度<" (angtos old_ro_ucs_z_ang 0 6) ">(默认为恢复视图): "))
- (setq ang (getangle))
- (if ang
- (XZST ang);什么也不输入,回车/空格
- ;else
- (progn
- (setvar "cmdecho" 0)
- (princ "恢复视图")
- (vl-load-com)
- (setq acadobject (vlax-get-acad-object)
- acaddocument (vla-get-activedocument acadobject))
- (if (equal (getvar "TILEMODE") 1)
- (progn
- (command "_.undo" "_group")
- (command "_.Plan" "w" "_.ucs" "w")
- (command "_.undo" "_end")
- )
- (if (= (vla-get-mspace acaddocument) :vlax-false)
- (command "mspace" "_.Plan" "w" "_.ucs" "w")
- (command "_.Plan" "w" "_.ucs" "w")
- )
- )
- (princ)
- );progn
- );if
- )
- ;;;恢复视图end
|