Jump to content

Zoom extents all layout tabs


BIGAL

Recommended Posts

Once you have multiple layout tabs its very easy to zoom in on a tab make some changes jump to another tab zoom in make some more changes, then save the dwg.

 

You then open the drawing to say plot and have to zoom e the layout as a glance to see if its correct etc

 

So I wrote this tiny lisp that will very quickly zoom extents on all layout tabs and then I would normally save, so I hope its usefull to others.

 

; goes through all layout tabs and zooms all
; By Alan H june 2011
(vl-load-com)
(command "_.pspace")
(setq curtab (getvar "Ctab"))
(setq this_dwg (vlax-get-acad-object))
(foreach d (layoutlist)
     (setvar "CTAB" d)
     (vla-ZoomExtents this_dwg)
)
(setvar "ctab" curtab)
(princ)

Link to comment
Share on other sites

A very useful routine. I wrote one a while back and we use it religiously. Be sure to make sure each layout is in paperspace (not model) before you zoom extents.

 

Here's mine:

(defun c:ZAL (/)
 ;; Zoom extents in All Layouts (excluding Model)
 ;; Alan J. Thompson
 (or *Acad* (setq *Acad* (vlax-get-acad-object)))
 (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument *Acad*)))
 ((lambda (ctab)
    (foreach layout (layoutlist)
      (setvar 'ctab layout)
      (vla-put-mspace *AcadDoc* :vlax-false)
      (vla-zoomextents *Acad*)
    )
    (setvar 'ctab ctab)
  )
   (getvar 'ctab)
 )
 (princ)
)

Link to comment
Share on other sites

  • 1 year later...
  • 3 years later...
  • 9 months later...

Hi BIGAL,

 

Tried it ... failed miserably ... can you let me know where I'm going wrong

 

(defun c:ZAL (/)
 ;; Zoom extents in All Layouts (excluding Model)
 ;; Alan J. Thompson
 (or *Acad* (setq *Acad* (vlax-get-acad-object)))
 (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument *Acad*)))
 ((lambda (ctab)
    (foreach layout (layoutlist)
      (setvar 'ctab layout)
      (vla-put-mspace *AcadDoc* :vlax-false)
      (vla-zoomextents *Acad*)
[color="red"];following line added
      (vla-zoom0.95x *Acad*)[/color]
    )
    (setvar 'ctab ctab)
  )
   (getvar 'ctab)
 )
 (princ)
)

Link to comment
Share on other sites

Thanks Cad64 that did the trick.

 

Thank's BIGAL, appreciated. I tried the following line of code and this also worked

(command "_.zoom" "_s" "0.95x")

Link to comment
Share on other sites

Once you have multiple layout tabs its very easy to zoom in on a tab make some changes jump to another tab zoom in make some more changes, then save the dwg.

 

You then open the drawing to say plot and have to zoom e the layout as a glance to see if its correct etc

 

So I wrote this tiny lisp that will very quickly zoom extents on all layout tabs and then I would normally save, so I hope its usefull to others.

 

; goes through all layout tabs and zooms all
; By Alan H june 2011
(vl-load-com)
(command "_.pspace")


* Once I loaded the app it ran it. How can I run the command without going to app load? Thanks again.
(setq curtab (getvar "Ctab"))
(setq this_dwg (vlax-get-acad-object))
(foreach d (layoutlist)
     (setvar "CTAB" d)
     (vla-ZoomExtents this_dwg)
)
(setvar "ctab" curtab)
(princ)

 

Hey BigAl. Dumb question. How do I start the lisp after I load it? I know that most use some type of letters to call up the command. I hate that I don't know how to do this, but would love to know how to. As always, thanks for any and every comment.

Edited by MillerMG
It worked
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...