Using Jake's example, I was unable to get any results. Using, Rich's example, I was able to return either ARCLENGTH or Shape_Length. But, it only returns one record at a time and the record with the largest OID. For instance, if I have 3 Shape_Length records selected, Shape_Length = 302.5 is returned. The script returns only the record with the highest OID value. Any ideas on how to return all three values? Something along the lines of: Shape_Length = 244.5Shape_Length = 692.9Shape_Length = 302.5for lyr in arcpy.mapping.ListLayers(mxd):
dsc = arcpy.Describe(lyr)
sel_set = dsc.fidSet.replace(";",",")
if dsc.shapeType == "Polyline" and dsc.fidSet != "":
cursor = arcpy.da.SearchCursor(lyr, ["OID@", "ARCLENGTH", "Shape_Length"], "OBJECTID IN (" + sel_set + ")")
for row in cursor:
arcLength = row[1]
shapeLength = row[2]
if len(arcLength) > 0:
arcpy.AddMessage("ArcLength = " + arcLength)
else:
arcpy.AddMessage("ShapeLength = " + str(shapeLength))
del row
del cursor