Jump to content

ZOOM EXTENTS INSIDE VIEWPORT AUTOMATICALLY


pmadhwal7

Recommended Posts

nearly 300 layouts to be prepare in my file, i just want to know is there any way to zoom and extents inside of all my viewports,

after.jpg

before.jpg

Edited by pmadhwal7
Link to comment
Share on other sites

I think you have asked wrong question, if you just zoom e its the same as copying 1 layout 299 times. That's LAYOUT command.

 

Do you mean walk along the pline and zoom at a scale inside a viewport making 300 layouts ?

Link to comment
Share on other sites

5 hours ago, BIGAL said:

I think you have asked wrong question, if you just zoom e its the same as copying 1 layout 299 times. That's LAYOUT command.

 

Do you mean walk along the pline and zoom at a scale inside a viewport making 300 layouts ?

actually i have 300 sheets and which i copy from another dwg and they already have viewports, lsp that rlx provided are perfectly fitting but only in one layouts

Link to comment
Share on other sites

in that case you need something like this

(setq old-ctab (getvar "CTAB"))
(foreach layout (layoutlist)
   (setvar "CTAB" layout)
   ;put call to mview zoom command here
)
(setvar "CTAB" old-ctab)

Edited by rlx
Link to comment
Share on other sites

2 hours ago, rlx said:

in that case you need something like this


(setq old-ctab (getvar "CTAB"))
(foreach layout (layoutlist)
   (setvar "CTAB" layout)
   ;put call to mview zoom command here
)
(setvar "CTAB" old-ctab)

please tell me where to put those code?

Link to comment
Share on other sites


;;; zoome.lsp - Zoom extents in all viewports - By Jimmy Bergmark - Copyright (C) 1997-2006 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com - E-mail: info@jtbworld.com - 2000-08-29 - Tested on AutoCAD 2000

(defun c:zoome (/ 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 nr 0 vpss (ssget "_x" (list
       '(-4 . "<AND") '(0 . "VIEWPORT")(cons 410 (getvar "ctab")) '(-4 . "<NOT") '(69 . 1) '(-4 . "NOT>") '(-4 . "AND>"))))
      (if vpss
        (repeat (sslength vpss)
          (setq en (entget (ssname vpss nr)))
          (if (and (= 0 (logand 1 (cdr (assoc 90 en))))(< 0 (cdr (assoc 68 en)))(/= 16384 (logand 16384 (cdr (assoc 90 en)))))
            (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"))
  )
  (setq vpss nil)(setvar "cvport" curcvport)(setvar "cmdecho" oldcmdecho)
  (princ)
)

; zoom extents all view ports rlx 2 jul 2020
(defun c:zeavp ( / c)(setq c (getvar "CTAB"))(foreach l (layoutlist) (setvar "CTAB" l)(c:zoome))(setvar "CTAB" c)(princ))

(princ "\nType zeavp or (c:zeavp) to run")
(princ)

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, rlx said:

Great Sir it was working fine thanks a lot


;;; zoome.lsp - Zoom extents in all viewports - By Jimmy Bergmark - Copyright (C) 1997-2006 JTB World, All Rights Reserved
;;; Website: www.jtbworld.com - E-mail: info@jtbworld.com - 2000-08-29 - Tested on AutoCAD 2000

(defun c:zoome (/ 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 nr 0 vpss (ssget "_x" (list
       '(-4 . "<AND") '(0 . "VIEWPORT")(cons 410 (getvar "ctab")) '(-4 . "<NOT") '(69 . 1) '(-4 . "NOT>") '(-4 . "AND>"))))
      (if vpss
        (repeat (sslength vpss)
          (setq en (entget (ssname vpss nr)))
          (if (and (= 0 (logand 1 (cdr (assoc 90 en))))(< 0 (cdr (assoc 68 en)))(/= 16384 (logand 16384 (cdr (assoc 90 en)))))
            (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"))
  )
  (setq vpss nil)(setvar "cvport" curcvport)(setvar "cmdecho" oldcmdecho)
  (princ)
)

; zoom extents all view ports rlx 2 jul 2020
(defun c:zeavp ( / c)(setq c (getvar "CTAB"))(foreach l (layoutlist) (setvar "CTAB" l)(c:zoome))(setvar "CTAB" c)(princ))

(princ "\nType zeavp or (c:zeavp) to run")
(princ)

 

 

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