• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Visual LISP, AutoLISP and General Customization

    Reply
    Member
    jonathan.talisman
    Posts: 4
    Registered: ‎02-22-2012

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

    124 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

    Please use plain text.
    Mentor
    Posts: 177
    Registered: ‎08-03-2007

    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
    Please use plain text.
    Member
    jonathan.talisman
    Posts: 4
    Registered: ‎02-22-2012

    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
    Please use plain text.