Is there a way to find out what layer a viewport is on??
All acad entities have a Layer property. First get the viewport object, then inspect its Layer property.
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, 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.
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.