FWIW,我使用这些函数:
- (defun c:UCSfollowOBJECT ( / e worldpoint v-size v-ctr)
- (setq Gb-ERROR '("UCSFOLLOW")
- Gb-ERROR (mapcar (function (lambda (a) (list 'setvar a (getvar a)))) Gb-ERROR)
- )
- (command "._undo" "_begin")
- (defun *error* (msg) (MAPCAR 'eval Gb-ERROR))
-
- (if (setq e (nentsel "\nSelect object to align UCS or [ENTER] to restore: "))
- (progn
- (setq v-size (getvar "VIEWSIZE") v-ctr (trans (getvar "VIEWCTR") 1 0))
- (setq worldpoint (trans (cadr e) 1 0))
- (setvar "UCSFOLLOW" 1)
- (command "._UCS" "_ob" (car e))
- (command "._zoom" "_CE" v-ctr v-size)
- ;(command ".pan" (trans worldpoint 0 1)(getvar "VIEWCTR"))
- (command "._pan" (trans worldpoint 0 1)(cadr (grread nil 7)))
- )
- ; else
- (command "._plan" "WORLD")
- )
- (eval Gb-ERROR)
- (setq *error* nil Gb-ERROR nil)
- (command "._undo" "_end")
- (princ)
- )
- (defun c:UCSWORLD ()
- (if (and (/= (getvar "VIEWTWIST") 0)(= (getvar "WORLDUCS") 1))(command ".plan" "World")(command ".UCS" "W"))
- (princ)
- )
|