Author Topic: Viewport Object Question  (Read 2032 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Viewport Object Question
« on: May 03, 2007, 04:21:00 PM »
I just created this lisp to report any layouts with a vp that is not on a specific layer.
Using the "skip the first viport in the database for each tab" to ignore the layout's vp object.
Is this reliable? Is there another way to detect it, Not using ssget?

Code: [Select]
;;  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
;;  Find vp not on layer "Viewport Borders"     
;;  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
(defun c:vpFind (/ vpLayer lay obj result id1)
  (setq vpLayer "Viewport Borders")
  (vlax-for lay (vla-get-layouts(vla-get-activedocument (vlax-get-acad-object)))
    (setq id1 nil) ; ignore the first vp
    (if (eq :vlax-false (vla-get-modeltype lay))
      (progn
        (princ (strcat "\n*** TAB - " (vla-get-name lay) "  ***"))
      (vlax-for obj (vla-get-block lay) ; for each obj in layout
        (if (and (= (vla-get-objectname obj) "AcDbViewport")
                 (or id1 (not (setq id1 t))))
         (if (/= (vla-get-layer obj) vpLayer)
          (progn ; collect vports
            (princ (strcat "\n" (vla-get-name lay) " -> " (vla-get-layer obj)))
            (setq result (cons (List lay obj) result))
          ))
        )
      ))
    )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Viewport Object Question
« Reply #1 on: May 03, 2007, 04:56:13 PM »
That looks spot on to me, Alan.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Viewport Object Question
« Reply #2 on: May 03, 2007, 06:02:12 PM »
Thank's for the feed back Jeff.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.