Author Topic: Total number of viewports in current layout?  (Read 2417 times)

0 Members and 1 Guest are viewing this topic.

scottcd

  • Newt
  • Posts: 52
Total number of viewports in current layout?
« on: January 28, 2009, 07:47:43 AM »
I can use the following to get the active viewport:

 
Code: [Select]
(setq ActiveVP (vla-get-activepviewport
   (vla-get-activedocument (vlax-get-acad-object))
)
  )

How can I find the total number of viewports, but only on the current layout?

Thanks

Scott
AutoCAD Dos R9 - 2018 and BricCAD 18.2

gile

  • Gator
  • Posts: 2522
  • Marseille, France
Re: Total number of viewports in current layout?
« Reply #1 on: January 28, 2009, 08:31:33 AM »
Hi,

Code: [Select]
(1- (sslength (ssget "_X" (list '(0 . "VIEWPORT") (cons 410 (getvar "CTAB"))))))
Speaking English as a French Frog

scottcd

  • Newt
  • Posts: 52
Re: Total number of viewports in current layout?
« Reply #2 on: January 28, 2009, 08:55:12 AM »
Thankyou  :-)
AutoCAD Dos R9 - 2018 and BricCAD 18.2

vladimirzm

  • Guest
Re: Total number of viewports in current layout?
« Reply #3 on: February 28, 2009, 06:38:07 PM »
hi i need something similiar
i need al pviewports entities as list instead of pviewports number, a list with all PViewports inside layout X.
the problem is remove the layout viewport from the list. (the 1- in your code)

i get it with ENTDEL, but this only works when layout X is active and need to run this lisp from model space, others methods has the same results.
the question is how can i get all PViewports inside layout X when model space is active


ronjonp

  • Needs a day job
  • Posts: 7535
Re: Total number of viewports in current layout?
« Reply #4 on: February 28, 2009, 10:15:37 PM »
« Last Edit: March 01, 2009, 10:07:41 PM by CAB »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

VovKa

  • Water Moccasin
  • Posts: 1637
  • Ukraine
Re: Total number of viewports in current layout?
« Reply #5 on: March 01, 2009, 06:48:09 AM »
vladimirzm,
Code: [Select]
(reverse
  (cdr
    (reverse
      (vl-remove-if
'listp
(mapcar
  'cadr
  (ssnamex
    (ssget "_X" (list (cons 0 "VIEWPORT") (cons 410 "LayoutName")))
  )
)
      )
    )
  )
)

vladimirzm

  • Guest
Re: Total number of viewports in current layout?
« Reply #6 on: March 01, 2009, 01:29:27 PM »
ok thnx