How to select all views in a drawing with a selectionset?

Discussion in 'AutoCAD' started by Erik Droog, Jul 21, 2004.

  1. Erik Droog

    Erik Droog Guest

    I want to add all PAPERSPACE views found in a drawing in a selection set.
    I tried the code below but it doesn't find any views although my drawing
    contains lots of them.

    Does anyone knows how to get this working?

    TIA

    Erik

    =============================================

    Public Sub FindPViews()
    Dim gpCode(1) As Integer
    Dim dataValue(1) As Variant
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET9")

    gpCode(0) = 0
    dataValue(0) = "TABLE"
    gpCode(1) = 2
    dataValue(1) = "VIEW"
    ssetObj.Select acSelectionSetAll, , , gpCode, dataValue

    MsgBox ssetObj.Count
    End
    End Sub
     
    Erik Droog, Jul 21, 2004
    #1
  2. Erik Droog

    Dragnsbld Guest

    you could use something like this:

    Sub Views()
    Dim colVws As New Collection
    Dim vwTst As AcadLayout
    Dim loTst As AcadLayouts

    Set loTst = ThisDrawing.Application.ActiveDocument.Layouts

    For Each vwTst In loTst
    If vwTst.ModelType = False Then
    colVws.Add vwTst.Name
    End If
    Next
    End Sub
     
    Dragnsbld, Jul 21, 2004
    #2
  3. You're looking for objects with a type of PVPORT, not VIEW.
     
    Frank Oquendo, Jul 21, 2004
    #3
  4. Typo alert!

    That's VIEWPORT, not PVPORT.
     
    Frank Oquendo, Jul 21, 2004
    #4
  5. Erik Droog

    Dragnsbld Guest

    The way it's written I thought it was for all the paperspace layouts.
    Views you can't get in VBA... VPorts however I think you can using the same principles as my previous post.
     
    Dragnsbld, Jul 22, 2004
    #5
  6. Erik Droog

    Erik Droog Guest

    I think you don't understand what I want.

    I wrote a plot routine and want to find out if a view in a drawing is made
    in paperspace or in modelspace.
    The views collection doesn't give any info about that so I thought it would
    be possible with the DXF group code in a Selectionset (same as SSGET in
    LISP)

    I thought the DXF group code for a view is "VIEW" and not "VIEWPOR"T"

    I changed the code to the code below but it doesn't work...it still returns
    0....


    Public Sub FindPViews()
    Dim gpCode(1) As Integer
    Dim dataValue(1) As Variant
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET1")

    gpCode(0) = 0
    dataValue(0) = "TABLE"
    gpCode(1) = 2
    dataValue(1) = "VIEWPORT"


    ssetObj.Select acSelectionSetAll, , , gpCode, dataValue

    MsgBox ssetObj.Count
    End
    End Sub
     
    Erik Droog, Jul 22, 2004
    #6
  7. That it is. A view is not a selectable object so you may not use a
    selection set to gather them up.
     
    Frank Oquendo, Jul 22, 2004
    #7
  8. Erik Droog

    Erik Droog Guest

    Does anyone know another way to get te space where a view is created?
     
    Erik Droog, Jul 23, 2004
    #8
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.