Is it possible to create a list of layers (residing in something like a menu) that can be selected and added to an mxd using arcpy.mapping. I've been using the bit of code below (there's someone I need to thank for this as I nabbed it from this site) to add a single layer. The code is within a Scripting Tool and is added to a toolbar as a Geoprocessing Tool.
import arcpy import arcpy.mapping #Data Location parcels = r'P:\Mapping\Data\Land.gdb\Parcels\Parcels' #Get the map document mxd = arcpy.mapping.MapDocument("CURRENT") #Get the data frame df = arcpy.mapping.ListDataFrames(mxd, "*") #Create new layer parcelLayer = arcpy.mapping.Layer(parcels) #Add the layer to the map at the bottom of the TOD in data frame 0 arcpy.mapping.AddLayer(df, parcelLayer, "TOP") #Refresh things arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df, parcelLayer
I want to avoid creating a script for each dataset that I want to add programatically to an mxd, but I also want to stay within Python/arcpy as I have no business trying to do this within ArcObjects. Any help is appreciated.