lyrs = arcpy.mapping.ListLayers(mxd, "Wells", df) # did you fetch anything?: print 'Number of layers successfully fetched: ' + str(len(lyrs)) # print the lyr names you just fetched, if any: for lyr in lyrs: print lyr.name # now access them individually for further processing: for i in range(len(lyrs)): lyr = lyrs # this sets the lyr variable to layer index i in the range print lyr.name + ' can now be processed.' # you can add code for further processing here
mxd = arcpy.mapping.MapDocument(r"C:\test.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] lyr = arcpy.mapping.ListLayers(mxd, "Wells", df)[0] arcpy.mapping.ExportReport(lyr, r"C:\CAD tables backup\CAD tables working\Reports\Wells.rlf", r"C:\CAD tables backup\CAD tables working\CAD tables\Wells.xls") ### lyr = arcpy.mapping.ListLayers(mxd, "Wells", df)[1] arcpy.mapping.ExportReport(lyr, r"C:\CAD tables backup\CAD tables working\Reports\Wells2.rlf", r"C:\CAD tables backup\CAD tables working\CAD tables\Wells2.xls") ### lyr = arcpy.mapping.ListLayers(mxd, "Wells", df)[2] arcpy.mapping.ExportReport(lyr, r"C:\CAD tables backup\CAD tables working\Reports\Wells3.rlf", r"C:\CAD tables backup\CAD tables working\CAD tables\Wells3.xls") ### lyr = arcpy.mapping.ListLayers(mxd, "Wells", df)[3] arcpy.mapping.ExportReport(lyr, r"C:\CAD tables backup\CAD tables working\Reports\Wells4.rlf", r"C:\CAD tables backup\CAD tables working\CAD tables\Wells4.xls")
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.