>>> # no selected records >>> d = arcpy.Describe("VennDiagram_1") >>> print d.FIDSet >>> print len(d.FIDSet) 0 >>> # I select two features >>> print d.FIDSet 7; 9 >>> # I clear the selection >>> print d.FIDSet >>> # I select all records (note that this is the same as selecting none... in ArcMap/geoprocessing, >>> # nothing selected means to process all features. ) >>> print d.FIDSet 4; 6; 7; 8; 9; 12 >>>
import arcpy # Import strftime from time module from time import strftime lyr = "Parcels_Layer" # MESSAGES FUNCTION def messages(message): arcpy.AddMessage(strftime("%m-%d-%Y %I:%M:%S %p ") + str(message)) print(strftime("%m-%d-%Y %I:%M:%S %p ") + str(message)) d = arcpy.Describe(lyr) if len(d.FIDSet) > 0: Feat_Sel_List = d.FIDSet.split(";") messages(len(Feat_Sel_List))
There must be something wrong with GetCount in ArcGIS 10.0.
number = int(gp.GetCount_management("mylayer"))
Result = arcpy.GetCount_management("my layer") number = int(Result.getOutput(0))
import arcpy # SET THE LAYER lyr = "Parcel_Poly" # SET THE FEATURE CLASS fc = "C:\\parcels.gdb\\parcels" # SEARCH THE LAYER lyr_rows = arcpy.da.SearchCursor(lyr, "PIN") lyr_Count = 0 for lyr_row in lyr_rows: lyr_Count += 1 del lyr_row, lyr_rows # SEARCH THE FC fc_rows = arcpy.da.SearchCursor(fc, "PIN") fc_Count = 0 for fc_row in fc_rows: fc_Count += 1 del fc_row, fc_rows if lyr_Count == fc_Count: #Do Something
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.