Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
jonathan.talisman
Posts: 4
Registered: ‎02-22-2012
Message 1 of 3 (218 Views)

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

218 Views, 2 Replies
02-22-2012 06:09 AM

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

Mentor
jtbworld
Posts: 181
Registered: ‎08-03-2007
Message 2 of 3 (212 Views)

Re: Getting to many viewports -- Iterating through viewPorts on a specific layou

02-22-2012 06:49 AM in reply to: jonathan.talisman

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
Specialities: AutoCAD, AutoCAD Architecture and Revit
http://www.jtbworld.com

JTB FlexReport - network license reports
http://www.jtbworld.com/jtbflexreport/index.htm
Member
jonathan.talisman
Posts: 4
Registered: ‎02-22-2012
Message 3 of 3 (206 Views)

Re: Getting to many viewports -- Iterating through viewPorts on a specific layou

02-22-2012 07:02 AM in reply to: jonathan.talisman
Great , thanks
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.