;Dynamic Zoom/Pan trick. Best for simpler drawings. ; ; Modified from a tip in Cadylst or Cadence (don't remember which). ; Modification requires UINT.LSP and UKWORD.LSP (see UUTILS.LSP) ; ; (defun c:dp ( / panpt input pt1 pt2 pt3 pt4 zin zout) (setq os_mod (getvar"osmode")) (setvar "osmode" 0) (setq whip (ukword 1 "In Out Stay" "\nPan and Zoom-In/Out/Stay" (if whip whip "Stay"))) (if (or (eq whip "In") (eq whip "Out") ) (setq zspd (uint 0 "" "\nZoom Speed (Slow=1, Fast=9)" (if zspd zspd 1)) zin (strcat(rtos(+ 1.0(/ zspd 100.000)))"x") zout (strcat(rtos(- 1.0(/ zspd 100.000)))"x")) ) (setq fctr (ukword 1 "Center Pan" "Zoom by Center or Pan?" (if fctr fctr "Pan"))) (if (eq fctr "Pan") (setq fctr nil) ) (while (and (setq INPUT (grread T)) (= (car INPUT) 5) ) (if fctr (setq PANPT (getvar "viewctr")) (if PANPT (setq PANPT (polar PANPT (angle PANPT (cadr INPUT)) (/ (getvar"viewsize") ; (distance (getvar"VSMAX")(getvar"VSMIN")) (/ ; 500 (*(getvar"viewsize")5) (max(distance (cadr INPUT) PANPT)0.003) ) ) ) ) (setq PANPT (cadr INPUT)) );if ); (if (>(distance PANPT(cadr INPUT))(*(getvar"viewsize")0.003)) (command ".zoom" "c" PANPT "") ) (cond ((eq whip "In") (command ".zoom" zin)) ; (princ(strcat"\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010Pan/Zoom-In " (rtos(car PANPT))","(rtos(cadr PANPT)))) ((eq whip "Out") (command ".zoom" zout)) ; (princ(strcat"\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010Pan/Zoom-Out " (rtos(car PANPT))","(rtos(cadr PANPT)))) ; ((eq whip "Stay") ; (princ(strcat"\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010\010Panning..." ; (rtos(car PANPT))","(rtos(cadr PANPT))))) ) ) (setvar "osmode" os_mod) (PRINC) ; (C:GPDGN) )