Sponsored links

【AutoLISP Portfolio】 Zoom an Area of 1/16 All Areas

Sponsored links
AutoLISP
Sponsored links
Jagaimo
Jagaimo

This command is used to zoom a particular area of 1/16, and sequentially to 16/16.

Sponsored links

Specification

This command divides a specific area into 16 rectangles, and it zooms to each area.

First, it zooms to area 1, and after clicking the screen or pressing the Enter key, it moves to area 2 etc…

The whole Area and the margin can be reset.

The default setting
Left Bottom Point: (0,0)
Right Top Point: (823.6,533.8)
Margin : 20

The whole rectangle area is defined by Left Bottom Point and Right Top Point.

Command Name

  • Zoom16 to Zoom area 1 to area 16
  • JagaZoomReset To reset the Whole Area (Left Bottom Point and Right Top Point) and Margin.

AutoLISP



(defun c:JagaZoomReset (/ Pt1 Pt2)

(princ "\n===========\n Zoom an Area of 1/16 Reset \n===========")

	(setq Pt1 (getpoint "Left Bottom Point:"))
	(setq Pt2 (getpoint "Right Top Point:"))
        (setq JagaMg (getint "Margin : "))

	(setq JagaBPX (car Pt1) JagaBPY (cadr Pt1) JagaPtX (car Pt2) JagaPtY (cadr Pt2))	
(princ)	
);

;--------------------------------------------

(defun c:Zoom16 ( / DefCmdEcho DefDynMode *error* JagaZoom16END)

   (setq DefCmdEcho (getvar "CMDECHO")) 
    (setvar "CMDECHO" 0)
   (setq DefDynMode (getvar "DYNMODE"))
    (setvar "DYNMODE" 3) 
  
   (defun *error* (msg)	
      (princ (strcat"\nJagaZoom16ERR\n " msg))
      (JagaZoom16END)
    (princ));defun Err
  
  (defun JagaZoom16END ()
     (setvar "CMDECHO" DefCmdEcho)
     (setvar "DYNMODE" DefDynMode)
   (princ "\n=========== JagaimoLISP.com ===========")
    (princ)
  );defun End
  
	(if
		(or(null JagaBPX)(null JagaBPY)(null JagaPtX)(null JagaPtY)(null JagaMg))
		(JagaZoomDef)
	);if
	
  
    (JagaZoom16 0 0.75 0.25 1 "1")
    (JagaZoom16 0.25 0.75 0.5 1 "2")
    (JagaZoom16 0.5 0.75 0.75 1 "3")
    (JagaZoom16 0.75 0.75 1 1 "4")

    (JagaZoom16 0 0.5 0.25 0.75 "5")
    (JagaZoom16 0.25 0.5 0.5 0.75 "6")
    (JagaZoom16 0.5 0.5 0.75 0.75 "7")
    (JagaZoom16 0.75 0.5 1 0.75 "8")

    (JagaZoom16 0 0.25 0.25 0.5 "9")
    (JagaZoom16 0.25 0.25 0.5 0.5 "10")
    (JagaZoom16 0.5 0.25 0.75 0.5 "11")
    (JagaZoom16 0.75 0.25 1 0.5 "12")

    (JagaZoom16 0 0 0.25 0.25 "13")
    (JagaZoom16 0.25 0 0.5 0.25 "14")
    (JagaZoom16 0.5 0 0.75 0.25 "15")
    (JagaZoom16 0.75 0 1 0.25 "16")
  
   (JagaZoom16END)

(princ))




;/////////////////////////////////////////

 (defun JagaZoom16 (ScX1 ScY1 ScX2 ScY2 Num / Pt1 Pt2)
  
   
	(setq 
    Pt1 
         (list 
           (-(+(*(- JagaPtX JagaBPX)ScX1)JagaBPX)JagaMg)
           (-(+(*(- JagaPtY JagaBPY)ScY1)JagaBPY)JagaMg)
         );list pt1
    
	  Pt2 (list 
          (+(+(*(- JagaPtX JagaBPX)ScX2)JagaBPX)JagaMg)
          (+(+(*(- JagaPtY JagaBPY)ScY2)JagaBPY)JagaMg)
        );list pt2
  );setq
	
	(command-s "._ZOOM" Pt1 Pt2)
   
   (if (= Num "16")
     (princ "--- End of JagaZoom16 ---")
     (getpoint (strcat Num "/16 " "Click or Entre to Next"))
   );if
  
(princ));defun

;--------------------------------------------	
; Default Setting
;--------------------------------------------	
(defun JagaZoomDef ()
	(if (null JagaPtX) (setq JagaPtX 823.6))
	(if (null JagaPtY) (setq JagaPtY 533.8))
	(if (null JagaBPX) (setq JagaBPX 0))
	(if (null JagaBPY) (setq JagaBPY 0))
	(if (null JagaMg) (setq JagaMg 20))	
);defun

;/////////////////////////////////////////

Comments