Layout tabs and viewports

Discussion in 'AutoCAD' started by chaseengineer, Oct 21, 2004.

  1. I have a drawing with 2 viewports on the "Layout1" tab.

    I know how to select the Layout tab using

    ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item("Layout1")

    Once I make Layout1 tab active, I want to freeze all layers except a layer called "Panel1" and then zoom extents in the first viewport. I then want to freeze all layers except a layer called "Panel2" and then zoom extents in the second viewport.

    Can someone give me guidance on this.

    Thanks
     
    chaseengineer, Oct 21, 2004
    #1
  2. chaseengineer

    Jeff Mishler Guest

    Here's one way using the VPLAYER command......

    Sub test2()
    Dim oTab As AcadLayout
    Dim oEnt As AcadEntity
    Dim oVPort As AcadPViewport
    Dim Lname As String
    Dim i As Integer

    ThisDrawing.ActiveLayout = ThisDrawing.Layouts.Item("Layout1")
    Set oTab = ThisDrawing.ActiveLayout
    For Each oEnt In oTab.Block
    If TypeOf oEnt Is AcadPViewport Then
    Set oVPort = oEnt
    ThisDrawing.MSpace = True
    If Not i = 0 Then 'Skip the first one found, it's the Paperspace VP
    ThisDrawing.ActivePViewport = oVPort
    Lname = "Panel" & i
    oVPort.Display (True)
    oVPort.DisplayLocked = False
    ThisDrawing.SendCommand ("vplayer f" & vbCr & "*" & vbCr & "c" &
    vbCr & _
    "t" & vbCr & Lname & vbCr & "c" & vbCr
    & vbCr)
    ThisDrawing.Application.ZoomExtents
    End If
    i = i + 1
    End If
    ThisDrawing.MSpace = False
    Next
    End Sub
     
    Jeff Mishler, Oct 21, 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.