Jump to content

Zoom Extend All layouts


Pither Rukka

Recommended Posts

Hi,

I usually drawing some layout in one file.

when review, after zooming on a layout I forgot to zoom extend before move to others layout.

Problem when save and close the file I need many time to zoom extend all layouts.

Could somebady help me a routine for zoom extend all layout.

Many Thank.

Pither Rukka

Link to comment
Share on other sites

;Zom 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 all layouts

(defun c:LZW (/ Ctab Layout P1 P2)
 (princ "\nLayouts Zoom Window")
 (if (/= (setq Ctab (getvar "CTAB")) "Model")
   (progn
     (command "PSPACE")
     (if (setq P1 (getpoint "\nSpecify first corner: "))
       (setq P2 (getcorner P1 "Specify opposite corner: "))
     )
     (if (and P1 P2)
       (foreach Layout (layoutlist)
         (command "LAYOUT" "S" Layout)
         (command "PSPACE")
         (command "ZOOM" "W" P1 P2)
       )
     )
   )
   (command "ZOOM" "W")
 )
 (setvar "CTAB" Ctab)
 (princ)
)

Link to comment
Share on other sites

;Zom 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 all layouts

(defun c:LZW (/ Ctab Layout P1 P2)
(princ "\nLayouts Zoom Window")
(if (/= (setq Ctab (getvar "CTAB")) "Model")
(progn
(command "PSPACE")
(if (setq P1 (getpoint "\nSpecify first corner: "))
(setq P2 (getcorner P1 "Specify opposite corner: "))
)
(if (and P1 P2)
(foreach Layout (layoutlist)
(command "LAYOUT" "S" Layout)
(command "PSPACE")
(command "ZOOM" "W" P1 P2)
)
)
)
(command "ZOOM" "W")
)
(setvar "CTAB" Ctab)
(princ)
)

 

will these unlock the viewports if its lock?

Link to comment
Share on other sites

The zooming operations from above routines are performed at layout sheets level, so doesn't affect the scale of viewports contained in those.

Link to comment
Share on other sites

The zooming operations from above routines are performed at layout sheets level, so doesn't affect the scale of viewports contained in those.

 

 

got it! i thought its inside the viewport

 

tested and working! should be useful routine!

thanks a lot!

Link to comment
Share on other sites

Another version:

;; Zoom Extents all Layouts  -  Lee Mac

(defun c:zea ( / app ctb doc )
   (setq app (vlax-get-acad-object)
         doc (vla-get-activedocument app)
         ctb (getvar 'ctab)
   )
   (foreach tab (layoutlist)
       (setvar 'ctab tab)
       (vla-put-mspace doc :vlax-false)
       (vla-zoomextents app)
   )
   (setvar 'ctab ctb)
   (princ)
)
(vl-load-com) (princ)

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Here's one I incorpoate with my save button

 

 
; Zoom All - In all layouts with one command
(defun c:ZoomLayouts ( / ctab)
(setq ctab (getvar "ctab"))

(foreach tab (cons "Model" (layoutlist))
 (setvar 'CTAB tab)
(command "zoom" "e" "limits" "off")
)
(setvar "ctab" ctab)
(princ)

Link to comment
Share on other sites

  • 3 years later...
Hi Lee, would it be possible to adjust routine so that it asked the user what zoom is required?

 

In what way? Choosing between Extents/Center/All?

Link to comment
Share on other sites

Between extents, and different percentage of zooms for example have the lowest percentage as 50%, then 75%, then 95% and finally extents. I have adapted the above routine but had to do it three additional times and labelled them as ZEA50, ZEA75, ZEA95 and ZEA. Another modification would be to have it ask whether to apply to current layout only or all layouts.

 

Before I close and save the file I run the ZEA75 routine which zooms all the layouts in the current drawing to 75% of the space shown on the screen. Then I save and close the file ready for the next working day.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...