Sponsored links

【AutoLISP Portfolio】 Zoom an Area of 1/16

Sponsored links
AutoLISP
Sponsored links
Jagaimo
Jagaimo

This command is used to zoom a particular area.

Sponsored links

Specification

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

There are 16 commands to zoom which are Z1 to Z16.
For example, Z1 zooms to area 1, and Z2 zooms 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

  • Z1 toZ16 To zoom each area
  • JagaZoomReset To reset the Whole Area (Left Bottom Point and Right Top Point) and Margin.

AutoLISP


;/////////////////////////////////////////////
;|
Jagaimo Lisp 
Zoom an Area of 1/16 20210302
|;
;/////////////////////////////////////////////

(defun c:Z1 ()(JagaZoom 0 0.75 0.25 1))
(defun c:Z2 ()(JagaZoom 0.25 0.75 0.5 1))
(defun c:Z3 ()(JagaZoom 0.5 0.75 0.75 1))
(defun c:Z4 ()(JagaZoom 0.75 0.75 1 1))

(defun c:Z5 ()(JagaZoom 0 0.5 0.25 0.75))
(defun c:Z6 ()(JagaZoom 0.25 0.5 0.5 0.75))
(defun c:Z7 ()(JagaZoom 0.5 0.5 0.75 0.75))
(defun c:Z8 ()(JagaZoom 0.75 0.5 1 0.75))

(defun c:Z9 ()(JagaZoom 0 0.25 0.25 0.5))
(defun c:Z10 ()(JagaZoom 0.25 0.25 0.5 0.5))
(defun c:Z11 ()(JagaZoom 0.5 0.25 0.75 0.5))
(defun c:Z12 ()(JagaZoom 0.75 0.25 1 0.5))

(defun c:Z13 ()(JagaZoom 0 0 0.25 0.25))
(defun c:Z14 ()(JagaZoom 0.25 0 0.5 0.25))
(defun c:Z15 ()(JagaZoom 0.5 0 0.75 0.25))
(defun c:Z16 ()(JagaZoom 0.75 0 1 0.25))
;--------------------------------------------

(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 JagaZoom (ScX1 ScY1 ScX2 ScY2 / Pt1 Pt2 DefCmdEcho JagaZoom16END *error*)
  
   (setq DefCmdEcho (getvar "CMDECHO")) 
    (setvar "CMDECHO" 0)
  
   (defun *error* (msg)	
      (princ (strcat"\nJagaZoom16ERR\n " msg))
      (JagaZoom16END)
    (princ));defun Err
  
  (defun JagaZoom16END ()
     (setvar "CMDECHO" DefCmdEcho)
   (princ "\n=========== JagaimoLISP.com ===========")
    (princ)
  );defun End
  
	(if
		(or(null JagaBPX)(null JagaBPY)(null JagaPtX)(null JagaPtY)(null JagaMg))
		(JagaZoomDef)
	);if
	
	(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)
  
  (JagaZoom16END)
);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