I'm working on a tool that identifies features and repairs them using an existing tool. At the moment I am struggling to put my idea into code however. The purpose is to use a search cursor from a Select Features By Location layer to identify and then select features in the original data and execute another tool. As of right now, my code looks something like this (in ArcMap 9.3):
Junctions_Lyr = "Junctions_Lyr"
gp.MakeFeatureLayer_management(Junctions, Junctions_Lyr, "", "", "")
gp.SelectLayerByLocation_management(Junctions_Lyr, "INTERSECT", Corrupt_Lyr, "", "NEW_SELECTION")
gp.SaveToLayerFile_management(Junctions_Lyr, "Junctions.lyr", Workspace)
rows = gp.SearchCursor(Junctions, "OBJECTID")
curs = gp.SearchCursor(Junctions_Lyr, "OBJECTID")
for row in rows:
if row.OBJECTID = curs.OBJECTID:
# Something to select the feature and run clean up tool.
rows.next()
else:
rows.next()
Essentially, this will (hopefully) select features in the Junctions Feature class if they intersect with a corrupted layer. They will then be selected and saved to file. The original feature class will then have a search cursor run through it, and, if the Object ID matches with one from the Saved Layer file, it will select the feature and run the clean up tool.
Am I approaching this correctly? I think my inability to properly articulate this is making the issue a lot more difficult to resolve.