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 (227 Views)

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

227 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: 182
Registered: ‎08-03-2007
Message 2 of 3 (221 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 (215 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.