import arcpy # Set the input line feature class fc = "C:/Temp/MyLineFeatureClass.gdb/MyLineFeatureClass" # Set the tolerance for duplicate vertices tolerance = 0.001 # Create a new cursor to iterate through the features in the input line feature class cursor = arcpy.da.SearchCursor(fc, ["SHAPE@", "OBJECTID"]) # Create a new empty list to store the XY coordinates of the duplicate vertices duplicate_vertices = [] # Iterate through the features in the input line feature class for row in cursor: # Get the shape of the feature shape = row[0] # Get the number of vertices in the shape num_vertices = shape.partCount # Iterate through the vertices in the shape for i in range(num_vertices - 1): # Get the XY coordinates of the current vertex current_vertex = shape.getPart(i).centroid # Get the XY coordinates of the next vertex next_vertex = shape.getPart(i + 1).centroid # Calculate the distance between the current vertex and the next vertex distance = current_vertex.distanceTo(next_vertex) # If the distance is less than the tolerance, then the vertices are considered duplicates if distance < tolerance: # Add the XY coordinates of the duplicate vertex to the list duplicate_vertices.append(current_vertex) # Close the cursor cursor.close() # Create a new empty list to store the XY coordinates of the duplicate vertices in string format duplicate_vertices_string = [] # Iterate through the duplicate vertices and convert them to string format for vertex in duplicate_vertices: # Convert the vertex to string format vertex_string = str(vertex.X) + "," + str(vertex.Y) # Add the vertex string to the list duplicate_vertices_string.append(vertex_string) # Export the XY coordinates of the duplicate vertices to a CSV file csv_file = open("C:/Temp/duplicate_vertices.csv", "w") csv_writer = csv.writer(csv_file) # Write the header row to the CSV file csv_writer.writerow(["X", "Y"]) # Write the XY coordinates of the duplicate vertices to the CSV file for vertex_string in duplicate_vertices_string: # Write the vertex string to the CSV file csv_writer.writerow([vertex_string]) # Close the CSV file csv_file.close()