I'm trying to automate some tasks for unit test. Once of these tasks is zooming into a map a fixed amount and forcing ArcMap to redraw at the new extent. The Data Frame is named Raster Data Sets.
The display is refreshing but it does not appear to honor the panToExtent() method. The AddMessage command shows that the value for the extent class was changed as expected.
ideas?
import arcpy
zoomScale=arcpy.GetParameterAsText(0)
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Raster Data Sets")[0]
lyr = arcpy.mapping.ListLayers(mxd, 'County Boundaries*', df)[0]
ext = lyr.getExtent()
arcpy.AddMessage("Old xmin, ymin, xmax, ymax: " + str(ext.XMin) + ", " + str(ext.YMin) + ", " + str(ext.XMax) + ", " + str(ext.YMax))
# change extent
temp = ext.XMin + float(zoomScale)
ext.XMin = temp
temp = ext.YMin + float(zoomScale)
ext.YMin = temp
temp = ext.XMax - float(zoomScale)
ext.XMax = temp
temp = ext.YMax - float(zoomScale)
ext.YMax = temp
arcpy.AddMessage("New xmin, ymin, xmax, ymax: " + str(ext.XMin) + ", " + str(ext.YMin) + ", " + str(ext.XMax) + ", " + str(ext.YMax))
df.panToExtent(ext)
arcpy.RefreshActiveView()
sys.argv[2]=True
arcpy.SetParameter(1,"True")