Author Topic: all viewports on  (Read 2437 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
all viewports on
« on: February 20, 2006, 05:02:01 PM »
Why won't the following code turn on all the viewports in a drawing? Do I have to cycle through each tab for it to work?

Code: [Select]
(defun c:allon (/ ss index obj)
  (if (setq ss (ssget "x" '((0 . "VIEWPORT") (-4 . "<>") (69 . 1))))
    (progn
      (setq index -1)
      (while (< (setq index (1+ index)) (sslength ss))
(setq obj (ssname ss index)
      obj (vlax-ename->vla-object obj)
)
(vla-put-ViewportOn obj :vlax-true)
      )
    )
  )
)

Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

whdjr

  • Guest
Re: all viewports on
« Reply #1 on: February 20, 2006, 05:24:14 PM »
I believe the answer to your question is yes and no.   :-)

I wrote a routine once that searched multiple tabs and tried to retrieve the coords of said viewports and then do a window in modelspace at those coords.  It didn't work because the viewports were not active (see dxf code 68).  I had to cycle thru each tab in order to get it to work.

With that being said I think I remember seeing some code where someone was able to access info about viewports on non-active viewports but they went about doing it a non-traditional method.  I don't remember who or where I saw this.

Sorry, :-(

ronjonp

  • Needs a day job
  • Posts: 7529
Re: all viewports on
« Reply #2 on: February 20, 2006, 05:30:14 PM »
Thanks for the reply Will. I wonder why you can globally lock all viewports without cycling through the tabs but you can't turn them off or on?

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC