Jump to content

Zoom Extents All


Zorg

Recommended Posts

Heres a neat little code that will zoome extents on all your viewports. Enjoy :D

 

(defun c:ze (/ oldcmdecho vplist curcvport nr vpss ms en x)
 (setq oldcmdecho (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 (setq vplist (mapcar 'car (vports)))
 (setq curcvport (getvar "cvport"))
 (if (= (getvar "tilemode") 0)
   (progn
     (if (= (setq ms (getvar "cvport")) 1)
       (command "._mspace")
     )
     (setq vpss (ssget "_x"
                       (list '(-4 . "<AND")
                             '(0 . "VIEWPORT")
                             (cons 410 (getvar "ctab"))
                             '(-4 . "<NOT")
                             '(69 . 1)
                             '(-4 . "NOT>")
                             '(-4 . "AND>")
                       )
                )
     )
     (setq nr 0)
     (if vpss                          ; in case there are no viewports
       (repeat (sslength vpss)
         (setq en (entget (ssname vpss nr)))
         (if (and (= 0 (logand 1 (cdr (assoc 90 en))))
                                       ; not perspective
                  (< 0 (cdr (assoc 68 en))) ; on and active
                  (/= 16384 (logand 16384 (cdr (assoc 90 en))))
                                       ; not locked
             )
           (progn
             (setvar "cvport" (cdr (assoc 69 en)))
             (command "._zoom" "_e")
           )
         )
         (setq nr (+ 1 nr))
       )
     )
     (if (= ms 1) (command "._pspace"))
   )
   (foreach x vplist
     (setvar "cvport" x)
     (command "._zoom" "_e")
   )
 )
 (setvar "cvport" curcvport)
 (setvar "cmdecho" oldcmdecho)
 (princ)
)

 

Z

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...