Refresh Active View Automatically

1986
2
01-09-2013 01:47 PM
PoMGIS
by
New Contributor
I am trying to work out how to have the arcmap active view refresh every few minutes or so automatically. This is so I can track the movement of some ships. At this stage it is to prove a concept. I know there is the arcpy.RefreshActiveView function, but I need it automatically plus the time frame. Any ideas? This is for Version 10
Tags (2)
0 Kudos
2 Replies
by Anonymous User
Not applicable
I am trying to work out how to have the arcmap active view refresh every few minutes or so automatically. This is so I can track the movement of some ships. At this stage it is to prove a concept. I know there is the arcpy.RefreshActiveView function, but I need it automatically plus the time frame. Any ideas? This is for Version 10


Yes, you should be able to do this with the sleep() function from the time module.  However, you won't be able to do much interaction with the map.  But, if you just want to watch ships move around, perhaps something like this might do the trick (in PythonWin in ArcMap of course):

>>> import arcpy
>>> from arcpy import mapping as m 
>>> from time import sleep
>>> mxd = m.MapDocument('CURRENT')
>>> df = m.ListDataFrames(mxd, "Layers")[0]
>>> count = 0
>>> while count < 5:
...     sleep(5)
...     arcpy.RefreshActiveView()
...     count +=1


This is just a simple test.  Inside the sleep() function you can list how many seconds you want it to wait.  You can set this for longer and have it loop however you want.  I just did that simple while loop as a test.  Although, I am not 100% sure this will work but it is the only thing I can think of.
0 Kudos
PoMGIS
by
New Contributor
Thanks for that Caleb. I will give it a go. I appreciate the quick response.
0 Kudos