synchronizing viewports

Discussion in 'AutoCAD' started by toddralph, Nov 5, 2004.

  1. toddralph

    toddralph Guest

    Hi,
    I posted this in AutoCAD 2004 NG a few days ago, but no replies. Hopefully will get some advice here... on to my problem - I want to have two viewports but I want to keep the scale and limits synchronized. ie, when I zoom or pan in one viewport, I want the other one to follow me. This is because I am digitizing using different background images (say aerial photo in one viewport, satellite imagery in the other). does anyone know of a method or utility to do this? Is it do-able in VBA? How about another application that will allow me to digitize in this manner and then export to DXF?

    thanks in advance,
    Todd
     
    toddralph, Nov 5, 2004
    #1
  2. toddralph

    grobsystems Guest

    Viewport modification is possible, but you will need to do some calculating of your "source" viewport to redefine the other viewport. Zooming 2 viewports on the fly sounds tricky. You will probably need to "zoom-stop-then calc the other viewport" and then continue...to get what you want. The Viewport object and the translate coordinates method is what you are looking for I believe.

    JRW
     
    grobsystems, Nov 5, 2004
    #2
  3. toddralph

    Kevin Terry Guest

    Below is a routine we use for matching the scale factor of one vport to
    another. It is a manual step we use, but maybe it will work for you or you
    can figure out a way to automate it. hth,


    ' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    .. . . . . . . . . . .
    '
    'Match viewport properties - uses zoom scale in paperspace from one to match
    the other
    '
    Public Sub Match_Vport()

    On Error GoTo Err_Match_Vport

    Dim newPViewport As AcadPViewport
    Dim basePnt As Variant
    Dim dScaleFactor As Double

    ThisDrawing.StartUndoMark

    ThisDrawing.Regen acActiveViewport

    'make sure in paperspace
    ThisDrawing.MSpace = False

    'prompt user to pick source viewport
    ThisDrawing.Utility.GetEntity newPViewport, basePnt, "Pick source
    viewport."

    'get zoom scale factor of picked vport
    dScaleFactor = newPViewport.CustomScale

    'prompt user to pick destination viewport
    ThisDrawing.Utility.GetEntity newPViewport, basePnt, "Pick destination
    viewport."

    'set zoom factor to same as first
    newPViewport.CustomScale = dScaleFactor

    ThisDrawing.Regen acActiveViewport

    ThisDrawing.EndUndoMark

    Exit Sub

    Err_Match_Vport:

    If Err.Number <> 0 Then _
    'display error message
    MsgBox "You must select valid viewports.", vbExclamation & vbOKOnly
    End If

    ThisDrawing.EndUndoMark

    End Sub


    Kevin

    will get some advice here... on to my problem - I want to have two viewports
    but I want to keep the scale and limits synchronized. ie, when I zoom or pan
    in one viewport, I want the other one to follow me. This is because I am
    digitizing using different background images (say aerial photo in one
    viewport, satellite imagery in the other). does anyone know of a method or
    utility to do this? Is it do-able in VBA? How about another application that
    will allow me to digitize in this manner and then export to DXF?
     
    Kevin Terry, Nov 6, 2004
    #3
  4. toddralph

    toddralph Guest

    Thanks for the advice and input, people. I am running with it and will keep you 'posted'... pardon the pun
    Todd
     
    toddralph, Nov 8, 2004
    #4
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.