Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting to many viewports -- Iterating through viewPorts on a specific layout .

2 REPLIES 2
Reply
Message 1 of 3
jonathan.talisman
449 Views, 2 Replies

Getting to many viewports -- Iterating through viewPorts on a specific layout .

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

2 REPLIES 2
Message 2 of 3

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.


Jimmy Bergmark
JTB World - Software development and consulting for CAD and license usage reports
https://jtbworld.com

Message 3 of 3

Great , thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost