Question about updating the map display from script

Discussion created by rfinch on Aug 12, 2011
Latest reply on Aug 18, 2011 by rfinch
Iâ??m just starting to learn ArcGIS scripting with python.

I have a table of locations and their x-y coordinates (DSM2OutputLocations.lyr). I have a small script (which will be part of a larger one) that selects a single desired location, and writes that one location to a .shp fileâ?¦see below. Eventually I will loop this over many locations, displaying each location one-by-one.

I can run this successfully in a Toolbox script. The problem is my ArcMap display doesnâ??t automatically update when the .shp file changes. Instead I have to manually tell ArcMap to re-read the .shp file so the map updates with the new output location display.

My question is, how to get ArcMap to automatically show the new output location. Is there a way to tell ArcMap to re-read the new .shp file? Or should I use another method entirely?

# Import arcpy module
import arcpy, os
from arcpy import env

env.workspace = "Z:/DSM2-GIS/"

# Local variables:
Output_Loc = "oldr_midr"

inLayer = "DSM2OutputLocations.lyr"
outFeature = "DSM2_Out_Loc.shp"
Select_Expr = "`NAME` = " + "'" + Output_Loc + "'"

# Process: Select
arcpy.Select_analysis(inLayer, outFeature, Select_Expr)