How to determine Hidden Viewport

Discussion in 'AutoCAD' started by danbush, Aug 20, 2004.

  1. danbush

    danbush Guest

    Howdy:

    I've searched the board and found no good answer to the following question: "How do you determine which Paperspace viewport is the hidden one associated with the layout itself?"

    I can get all of the paperspace viewports using a selectionset and generally, the hidden ones are always on layer 0 and have vastly different coordinates than the other viewports...

    I don't see anything in the viewport's extended data that distinguishs the hidden vport from a normal one.

    these are not probably good things to bank on always ( a user can put viewports on any layer, including 0 )...

    I also don't like using a vb for-each loop due to the overhead of looping through EVERY object in paperspace - lots of objects in big drawings = slow loops ]

    any ideas?
     
    danbush, Aug 20, 2004
    #1
  2. danbush

    Jeff Mishler Guest

    Like this.....Yes I use a For Each loop, but the Layout PS Viewport will
    ALWAYS be the first one found so I can Exit the loop once it is retrieved.
    ;-)

    Function get_PS_vport() As Variant
    Dim ent As AcadEntity
    Dim oTab As AcadLayout
    Dim i As Integer
    Dim arrVP() As AcadPViewport
    ReDim arrVP(0 To 500)

    For Each oTab In ThisDrawing.Layouts
    For Each ent In oTab.Block
    If TypeOf ent Is AcadPViewport Then
    Set arrVP(i) = ent
    i = i + 1
    Exit For
    End If
    Next ent
    Next oTab
    ReDim Preserve arrVP(0 To i - 1)
    get_PS_vport = arrVP
    End Function

    Sub test()
    Dim test1
    test1 = get_PS_vport
    End Sub


    --
    Jeff
    check out www.cadvault.com
    question: "How do you determine which Paperspace viewport is the hidden one
    associated with the layout itself?"
    generally, the hidden ones are always on layer 0 and have vastly different
    coordinates than the other viewports...
    hidden vport from a normal one.
    viewports on any layer, including 0 )...
    through EVERY object in paperspace - lots of objects in big drawings = slow
    loops ]
     
    Jeff Mishler, Aug 20, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.