I am writing some AutoLisp routines and I am doing the following :
; the layout parameter is a vla-object of type of a layout
(defun-q get-ViewPorts (Layout / LayoutBlock ViewPorts)
(setq LayoutBlock (vla-get-Block layout))
(vlax-for i LayoutBlock
(if (= "AcDbViewport" (vla-get-objectName i ))
(setq viewPorts (cons i viewPorts))
The problem is that I am getting one viewport too many - if there are no viewports I get one , if there is one I get two etc.... I am guessing the layout itself or any current view is some sort of a AcDbViewPort ~ how do I 'filter ' it out .
Thanks , Jonathan
The paper space has a viewport itself so if you want the number of viewports subtract the total with one.
The first viewport in each layout is the layout itself.