Viewport's layer

Discussion in 'AutoCAD' started by Matt W, Mar 1, 2004.

  1. Matt W

    Matt W Guest

    Is there a way to find out what layer a viewport is on??
     
    Matt W, Mar 1, 2004
    #1
  2. Matt W

    Ed Jobe Guest

    All acad entities have a Layer property. First get the viewport object, then inspect its Layer property.
     
    Ed Jobe, Mar 1, 2004
    #2
  3. Matt W

    Matt W Guest

    That's what I figured.... Maybe I'm going about this the wrong way??
    This is what I started with...


    --------------------------------------------------------------------------------

    Public Sub Test()
    Dim vp As AcadViewport

    For Each vp In ThisDrawing.Viewports
    MsgBox vp 'nothing for layer name??!?
    Next

    End Sub

    --------------------------------------------------------------------------------

    Matt W

    There are 3 kinds of people:
    Those who can count, and those who can't.


    All acad entities have a Layer property. First get the viewport object, then inspect its Layer property.
     
    Matt W, Mar 1, 2004
    #3
  4. Matt W

    Wayne Craig Guest

    Matt,

    This should get you started:

    Sub MyViewportLayers()
    Dim objEntity As AcadEntity
    For Each objEntity In ThisDrawing.PaperSpace
    If objEntity.ObjectName = "AcDbViewport" Then
    Debug.Print objEntity.Layer
    End If
    Next objEntity
    End Sub

    Wayne


    That's what I figured.... Maybe I'm going about this the wrong way??
    This is what I started with...


    ------------------------------------------------------------------------------

    Public Sub Test()
    Dim vp As AcadViewport

    For Each vp In ThisDrawing.Viewports
    MsgBox vp 'nothing for layer name??!?
    Next

    End Sub

    ------------------------------------------------------------------------------

    Matt W

    There are 3 kinds of people:
    Those who can count, and those who can't.


    All acad entities have a Layer property. First get the viewport object, then inspect its Layer property.
     
    Wayne Craig, Mar 1, 2004
    #4
  5. Matt W

    Ed Jobe Guest

    You can also use the TypeOf keyword in your If statement.
    If TypeOf objEntity Is AcadPViewport Then

    --
    --
    Ed
    --
    Matt,

    This should get you started:

    Sub MyViewportLayers()
    Dim objEntity As AcadEntity
    For Each objEntity In ThisDrawing.PaperSpace
    If objEntity.ObjectName = "AcDbViewport" Then
    Debug.Print objEntity.Layer
    End If
    Next objEntity
    End Sub

    Wayne


    That's what I figured.... Maybe I'm going about this the wrong way??
    This is what I started with...


    ----------------------------------------------------------------------------

    Public Sub Test()
    Dim vp As AcadViewport

    For Each vp In ThisDrawing.Viewports
    MsgBox vp 'nothing for layer name??!?
    Next

    End Sub

    ----------------------------------------------------------------------------

    Matt W

    There are 3 kinds of people:
    Those who can count, and those who can't.


    All acad entities have a Layer property. First get the viewport object, then inspect its Layer property.
     
    Ed Jobe, Mar 1, 2004
    #5
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.