English

How To: Measure the duration of a View redraw [SCRIPT]

Procedure

This document shows how to measure the duration of a zoom, or a refresh of the view display.

Answer:

This script measures the time a redraw takes. It is recommended that you
attach this script to a button on your View GUI.

'--- DURATION.AVE

'--- This scripts returns a MsgBox with the duration of time
'--- the View takes to redraw after a zoom
'--- Jim Barry, ESRI Technical Support

av.GetProject.SetModified(true)
theView = av.GetActiveDoc '-- Set up the zoom
theDisp=theView.GetDisplay
myZoom=msgbox.input("enter the percentage of the zoom. Enter FE if you want to
zoom to the full extent of the view","Measure duration of a zoom
redraw","200")

if (myZoom = "FE")
then
a=Date.Now 'get the current time
av.Run("View.ZoomFullExtent", nil)
else
a=Date.Now 'get the current time
theDisp.ZoomIn(myZoom.AsNumber) '-- Do the Zoom
end

theDisp.Flush 'pause the run of this script until the redraw is finished

b=Date.Now 'get the time now
c=b-a 'find the duration
d=c.AsSeconds 'convert the duration into seconds
MsgBox.Info("The zoom redraw lasted" ++ d.AsString ++ "seconds","duration")
'return the results back to the user

'---- End of Script