I have a topology that covers a big area. I cannot validate all at once 'cause I get errors. So I've created a grid that covers the area. Through a script runned from my .mxd I intend to: 1. itterate through each grid cell 2. set it as the current extent of the map, 3. use the tool "Validate Topology", having checked the option "VISIBLE_EXTENT".
The workflow sounds correct to me, but I'm blocked at the first two steps. Here's my code:
import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers") gridLayer = arcpy.mapping.ListLayers(mxd, "Caroiaj_RO", df) # Create SearchCursor with arcpy.da.SearchCursor(gridLayer, ("GridName2")) as cursor: # Start a loop that iterates through all rows for row in cursor: # Clause to select only the current record whereClause = ' "GridName2" = ' + str(row.GridName2) # Select Layer by attribute arcpy.SelectLayerByAttribute_management(gridLayer, "NEW_SELECTION", whereClause) df.extent = gridLayer.getSelectedExtent(True) arcpy.RefreshActiveView() del cursor, row del mxd
Thanx a lot!