apsonwane Posted November 8, 2010 Posted November 8, 2010 Hi, Is it possible to auto zoom extent all layouts in current drawing with single command using auto list routine? I am using autocad 2011. FYI, I found routine on this site (see below link), but this routine extents all vieports in active layout. http://www.cadtutor.net/forum/showthread.php?36349-Zoom-Extents-All Thanks in advance for your help. Regards, Ashish Quote
asos2000 Posted November 8, 2010 Posted November 8, 2010 Zoom extends ;zOOM EXTENDS ALL LAYOUTS (defun c:LZE (/ Ctab Layout) (princ "\nLayouts Zoom Extents") (setq Ctab (getvar "CTAB")) (foreach Layout (layoutlist) (command "LAYOUT" "S" Layout) (command "PSPACE") (command "ZOOM" "E") ) (setvar "CTAB" Ctab) (princ) ) Zoom window (defun c:LZW (/ Ctab Layout P1 P2) (princ "\nLayouts Zoom Window") (if (/= (setq Ctab (getvar "CTAB")) "Model") (progn (command "PSPACE") (if (and (setq P1 (getpoint "\nSpecify first corner: ")) (setq P2 (getcorner P1 "Specify opposite corner: ")) ) (foreach Layout (layoutlist) (command "LAYOUT" "S" Layout) (command "PSPACE") (command "ZOOM" "W" P1 P2) ) ) ) (command "ZOOM" "W") ) (setvar "CTAB" Ctab) (princ) ) Both lisps NOT mine Quote
Sweety Posted November 8, 2010 Posted November 8, 2010 Both lisps NOT mine Great routines sir. But since they don't belong to you. Why did you remove the name of the Author ? A very big question . Quote
apsonwane Posted November 8, 2010 Author Posted November 8, 2010 Thanks a lot asos. This works perfectly as required & helps aout a lot to me. Cheers, Ashish Quote
asos2000 Posted November 8, 2010 Posted November 8, 2010 Great routines sir.... A very big question . I found these lisps as it is And searched now over net found this link http://autolisp-exchange.com/Forums/Forum2/F2T1P3.htm Quote
pBe Posted November 8, 2010 Posted November 8, 2010 (defun c:lze (/ This_Drawing lyouts) (setq This_Drawing (vla-get-activedocument (vlax-get-acad-object)) lyouts (vla-get-layouts This_Drawing)) (vlax-for ly lyouts (if (eq (vla-get-modeltype ly) :vlax-false) (progn (vl-cmdf "_.layout" "S" (vla-get-name ly)) (vl-cmdf "_.Zoom" "E") ) ) ) ) oops too late Quote
Sweety Posted November 8, 2010 Posted November 8, 2010 (defun c:lze (/ This_Drawing lyouts) (setq This_Drawing (vla-get-activedocument (vlax-get-acad-object)) lyouts (vla-get-layouts This_Drawing)) (vlax-for ly lyouts (if (eq (vla-get-modeltype ly) :vlax-false) (progn (vl-cmdf "_.layout" "S" (vla-get-name ly)) (vl-cmdf "_.Zoom" "E") ) ) ) ) oops too late Nice one buddy, but it does not go back to the Model Space as it was before. Thank you Quote
Sweety Posted November 8, 2010 Posted November 8, 2010 I guess the following would solve the issue at the end of your routine. (setvar 'tilemode 1) Thanks Quote
Sweety Posted November 8, 2010 Posted November 8, 2010 I found these lisps as it is And searched now over net found this link http://autolisp-exchange.com/Forums/Forum2/F2T1P3.htm Thank you man, that's much better for all for honesty. Many thanks Quote
apsonwane Posted November 8, 2010 Author Posted November 8, 2010 Hi, Can we stop the screen fluctuations & scrooling of text over command line during execution of this LZE command?? This irritates eyes, specially when you have several layouts. - Ashish Quote
Lee Mac Posted November 8, 2010 Posted November 8, 2010 (defun c:lze ( / ot ac ) (vl-load-com) (setq ot (getvar 'CTAB) ac (vlax-get-acad-object)) (foreach l (layoutlist) (setvar 'CTAB l) (vla-ZoomExtents ac)) (setvar 'CTAB ot) (princ) ) Or to avoid Zooming in Viewports: (defun c:lze ( / ot ac doc ) (vl-load-com) (setq ot (getvar 'CTAB) ac (vlax-get-acad-object) doc (vla-get-ActiveDocument ac)) (foreach l (layoutlist) (setvar 'CTAB l) (vla-put-MSpace doc :vlax-false) (vla-ZoomExtents ac) ) (setvar 'CTAB ot) (princ) ) 1 Quote
pBe Posted November 8, 2010 Posted November 8, 2010 (edited) (vla-ZoomExtents ac)) !!!! thats what i'm lookig for (slap forehead) ... cool Lee MAc you never cease to amazed us (defun c:PE:LZE () (vl-load-com)(setq prv (getvar 'CTAB) dwg (vlax-get-acad-object)) (mapcar '(lambda (x) (setvar 'CTAB x) (vla-ZoomExtents dwg)) (layoutlist)) (setvar 'CTAB prv) ) To be honest, i never knew about (layoutlist) until today... learning new stuff everyday Edited November 8, 2010 by pBe add code Quote
alanjt Posted November 8, 2010 Posted November 8, 2010 Zoom window one I sometimes use... (defun c:LZW (/ ctab pt cor) ;; Layout Zoom Window (zoom to same window in all layouts) ;; Alan J. Thompson, 11.10.09 (if (zerop (getvar 'tilemode)) (progn (setq ctab (getvar 'ctab)) (vla-put-MSpace (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (cond (*Acad*) ((setq *Acad* (vlax-get-acad-object))) ) ) ) ) ) :vlax-false ) (if (and (setq pt (getpoint "\nSpecify first corner: ")) (setq cor (getcorner pt "\nSpecify opposite corner: ")) ) ((lambda (zoom) (foreach x (layoutlist) (setvar 'ctab x) (vla-put-MSpace *AcadDoc* :vlax-false) (apply (function vla-ZoomWindow) zoom) ) (setvar 'ctab ctab) ) (cons *Acad* (mapcar (function vlax-3d-point) (list pt cor))) ) ) ) (alert "Sorry, command not allowed in Model Tab.") ) (princ) ) Quote
apsonwane Posted November 8, 2010 Author Posted November 8, 2010 Thanks Lee MAc. Can't we stop this irritating blinking screen during execution of this routine!!! Quote
Lee Mac Posted November 8, 2010 Posted November 8, 2010 Thanks Lee MAc. Can't we stop this irritating blinking screen during execution of this routine!!! Close your eyes? Quote
alanjt Posted November 8, 2010 Posted November 8, 2010 Any excuse lol If I close my eyes, I'll be too tempted for a nap. Quote
Lee Mac Posted November 8, 2010 Posted November 8, 2010 If I close my eyes, I'll be too tempted for a nap. Quote
alanjt Posted November 8, 2010 Posted November 8, 2010 One could just stand up and wave glow sticks around. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.