Hey @ALL,
a customer of us is asking for a function that refreshes automatically the active view and the TOC in ArcMap every minute (or similiar).
As there is no existing function we were thinking about developing a python add-in. These were our steps:
(1) Starting the Python-Add-In Wizard
(2) Setting the project settings
(3) Setting an extension as an Add-In content
(4) Writing the python code:
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">import</SPAN> pythonaddins
<SPAN class="keyword token">import</SPAN> time
<SPAN class="keyword token">class</SPAN> <SPAN class="token class-name">ArcMapRefresh</SPAN><SPAN class="punctuation token">(</SPAN>object<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="string token">"""Implementation for ArcMap_auto_refresh_addin.refresh (Extension)"""</SPAN>
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">__init__</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
<SPAN class="comment token"># For performance considerations, please remove all unused methods in this class.</SPAN>
self<SPAN class="punctuation token">.</SPAN>enabled <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">False</SPAN>
<SPAN class="keyword token">def</SPAN> <SPAN class="token function">newDocument</SPAN><SPAN class="punctuation token">(</SPAN>self<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">:</SPAN>
i <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
k <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
<SPAN class="keyword token">while</SPAN> i <SPAN class="operator token">==</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN>