import arcpy infc =r"D:\POINTS.shp" #identify geometry field desc = arcpy.Describe(infc) shapefieldname = desc.ShapeFieldName #Create primary Search Cursor rows = arcpy.SearchCursor(infc) pointsList = [] count = 0 #iterator counter for testing #create a list of the points for row in rows: feat = row.getValue(shapefieldname) point = feat.getPart() pointsList.append(point) count = 0 for point1 in pointsList: #print point1.X for point2 in pointsList[1:]: if point1 != point2: print (point1,point2)
Solved! Go to Solution.
# itertools standard module's combinations function does it clearly import itertools for point1, point2 in itertools.combinations(pointsList, 2): print point1.X, point2.X
# make a duplicate of the original point list tempPointList = pointList[:] for point1 in pointsList: # remove the current point from the temp list tempPointList.remove(point1) for point2 in tempPointList: # point1 and point2 to make a pair print (point1.X, point2.X)
# itertools standard module's combinations function does it clearly import itertools for point1, point2 in itertools.combinations(pointsList, 2): print point1.X, point2.X