HOW TO
The Avenue code below allows you to define a set of coordinates to center a view's display.
Code:
' SetViewDisplayCenter
' This script pans the view display extent to the center of the
' specified x,y coordinate while retaining the
' view's original extent.
' The view must be the active document when running the script.
theView = av.GetActiveDoc
theDisplay=theView.GetDisplay
'Get Visible Extent
theExtent=theDisplay.ReturnVisExtent
theSize=theExtent.ReturnSize
theSizeX=theSize.GetX
theSizeY=theSize.GetY
'Calculate the x and y sizes divided by 2
thesizeX2=theSizeX/2
theSizeY2=theSizeY/2
'Set Message Box Input
labels={"x","y"}
defaults={"0","0"}
'Enter new Coos
userXY=MsgBox.MultiInput("Enter the new coos","View Move",labels,defaults)
'Get and convert Coos to numbers
userX=userXY.Get(0).AsNumber
userY=userXY.Get(1).AsNumber
'Calculate the new rectangle's Size
userx2=userX-theSizeX2
userY2=userY-theSizeY2
userx22=userX+theSizeX2
userY22=userY+theSizeY2
'Make the Rectangle
theNewExtent=Rect.MakeXY(userx2,usery2,userx22,usery22)
'Set the new extent
theDisplay.SetExtent(theNewExtent)
Article ID:000005055
Get help from ArcGIS experts
Download the Esri Support App