Select to view content in your preferred language

manual selection as input parameter for a script

2495
0
09-20-2013 08:22 AM
oscarespitia
Emerging Contributor

I  need a arcpy  script to process data from a selection, it's made manually in arcmap.
the selection is part of a mesh, to print data from a specified field.

Can i put a selection made ??????manually as input parameter for a script?



until now, I have a script that processes the selection stored in a layer that is displayed in the TOC




 #import arcpy module
#
import arcpy


# Load the MXD  default document
#
mxd = arcpy.mapping.MapDocument("CURRENT")


# Define the TOC default Data Frame
#
df = arcpy.mapping.ListDataFrames(mxd, "Capas")[0]


#access to the target (mesh selection), stored in a layer,
#By selecting the corresponding layer located on the TOC
#
fc = arcpy.mapping.ListLayers(mxd,"",df)[0]


#define of the field to consult.
#
field = "idMalla"

print "campo idMalla: "
# query  for reading  a specified field.
#
cursor = arcpy.SearchCursor(fc)
for row in cursor:
    print(row.getValue(field))


# delete memory
del mxd, df



[ATTACH=CONFIG]27638[/ATTACH]
Tags (2)
0 Kudos
0 Replies