COPYVIEW_PASTEVIEW_v1_00.........................free

Command: COPYVIEW

Copies to clipboard current view state (to paste it in another drawing). Can be useful when the user needs to compare multiple drawings in the same location on view

Command: PASTEVIEW

Pastes current view state 

 

Code:

;;; ================================================
;;;        COPYVIEW_PASTEVIEW_v1_00.LSP     
;;;
;;;        Written by Andrzej Kalinowski,     www.autolisps.blogspot.com
;;;        v1.00 - 28.07.2024 - first release

;;;
;;;        Command: COPYVIEW
;;;            Copies to clipboard current view state (to paste it in another drawing)
;;;
;;;        Command: PASTEVIEW
;;;            Pastes current view state 
;;; ================================================
(vl-load-com)

;;; ================================================
;                           COPYVIEW
;;; ================================================
(defun c:COPYVIEW ( /   Var1)
    ;(getvar "VIEWSIZE");    returns 17378.3
    ;(getvar "VIEWCTR") );    returns  (9126.21 5966.12 0.0)
    (setq Var1
        (strcat 
            "A" (rtos (getvar "VIEWSIZE") )
            "B" (rtos (nth 0 (getvar "VIEWCTR")))
            "C" (rtos (nth 1 (getvar "VIEWCTR")))
            "D" (rtos (nth 2 (getvar "VIEWCTR")))
        );strcat
    );setq
    (setenv "COPYVIEW_env" Var1)
    (princ)
);defun
;;; ================================================
;                           PASTEVIEW
;;; ================================================
(defun c:PASTEVIEW ( /  ViewSiz1 Viewctr1 Var1 X1 Y1 Z1 )
    (setq Var1 (getenv "COPYVIEW_env"))
    (setq Z1 (atof (substr Var1 (+ 2 (vl-string-search "D" Var1 )) (strlen Var1 ))))
    (setq Var1 (substr Var1 1 (vl-string-search "D" Var1 )) )
    (setq Y1 (atof (substr Var1 (+ 2 (vl-string-search "C" Var1 )) (strlen Var1 ))))
    (setq Var1 (substr Var1 1 (vl-string-search "C" Var1 )) )
    (setq X1 (atof (substr Var1 (+ 2 (vl-string-search "B" Var1 )) (strlen Var1 ))))
    (setq Var1 (substr Var1 1 (vl-string-search "B" Var1 )) )
    (setq ViewSiz1 (atof (substr Var1 (+ 2 (vl-string-search "A" Var1 )) (strlen Var1 ))))
    (setq Viewctr1    (list X1 Y1 Z1))
    (vla-zoomcenter (vlax-get-acad-object) (vlax-3D-point (trans Viewctr1 1 0) ) ViewSiz1)
    (princ)
);defun


Example:








 Version history:
v1.00 - 28.07.2024 - first release


 Compatibility:
-All Autocad
versions

Download file: COPYVIEW_PASTEVIEW_v1_00.FAS


No comments:

Post a Comment