Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Was trying to replicate a RePast Agent Analyst simulation using just Python and arcpy. The script was about urban expansion. The script just changes the values of a column in a shape file. ArcMap's symbology just color codes the parcels in the map based on the values of the mentioned column. The script just needs a way to refresh/reload the display for every step ( when the values in the column are changed ) of the simulation to show the user the changes.

I tried arcpy's RefreshActiveView but it doesn't work. Is there a way to to do it using arcpy? Or do I have to use ArcObjects for this? Thanks in advance.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

I've never run a cursor through arcpy in a running instance of ArcMap as you mention in the comment to MLowry's answer, but I would hazard a guess that if you simply want to refresh the display, you could perform an action using the mapping module. For instance, once creating a reference to the data frame in question, you could change the scale to a given value, which should trigger a redraw of whatever is in that active view (data frame). Alternatively, using the code to switch to Page Layout and back to Data View might also do the trick. It's hokey, but it might work for you.

share|improve this answer
    
Haven't used the mapping module. Thanks :D Will test it as soon as I get to the lab. –  R.K. Jun 7 '11 at 4:28
1  
You're gonna love the mapping module. –  Roy Jun 5 '12 at 18:58

The RefreshActiveView command should work for this, as far as I know. A quick few questions that might help troubleshoot:

Could you post a snippet of your .py in order to see which functions are running so we know what type of work is going on that is changing the values; this could have an effect on why it is not refreshing. Are you looking for the symbology to update due to the new values in the table?

ArcObjects could also be utilized in this scenario, but I prefer to not mix Objects and Python if possible because it has causes me a few issues in the past calling one from the other.

share|improve this answer
    
Still looking for my old code. Used UpdateCursor and SearchCursor to edit the values in the column. When I load the script from within the Python console, it crashes. I ended up using arcgisscripting and ArcGIS 9.3. When I run it by separately but with ArcMap open, it runs but the display in ArcMap won't refresh/reload. –  R.K. Jun 3 '11 at 16:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.