Hi,
I am on ArcGIS 10.1 SP1 (Build 3143)
I have a python toolbox that is producing a number of shapefile outputs that I would like to add to the ArcGIS TOC.
Problem I am having is that whilst the layers add to the TOC while the tool is running when it completes the layers are deleted, and I can't seem to find a way to avoid this.
Anybody have any ideas? My code (pretty standard) is below:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd."*")[0]
addLayer = arcpy.mapping.Layer(outputFeatureclass)
arcpy.mapping.AddLayer(df, addLayer,"BOTTOM")
arcpy.RefreshTOC()
arcpy.RefreshActiveView()
Thanks for any help!
Steve
mxd.save()
and make sure that you haven't set your geoprocessing options to have results temporary by default
Thanks Dan for your response.
Unfortunatly none of these work for me..
I have the same problem, could you solve it?