import arcpy rows = arcpy.UpdateCursor("Points") mxd = arcpy.mapping.MapDocument("CURRENT") print mxd.filePath for row in rows: LINENO = row.getValue("Line_ID") print "LINENO " + str(LINENO) for lyr in arcpy.mapping.ListLayers(mxd): print "lyr.name " + lyr.name lyrname = lyr.name if lyr.name in ["AllLines"]: print "LINENUMBER = '" + str(LINENO) + "'" lyr.definitionQuery = "LINENUMBER = '" + str(LINENO) + "'" snapEnv = ["AllLines", "EDGE", "2 Meters"] arcpy.Snap_edit("Points", [snapEnv]) del row, rows, mxd
mxd = arcpy.mapping.MapDocument("CURRENT") rows = arcpy.UpdateCursor("Points") for row in rows: POINTNO = row.getValue("Line_ID") for lyr in arcpy.mapping.ListLayers(mxd): if lyr.name in "AllLines": lyr.definitionQuery = "\"LINENO\" = " + str(POINTNO) arcpy.RefreshActiveView() if lyr.name in "Points": lyr.definitionQuery = "\"POINTNO\" = " + str(POINTNO) arcpy.RefreshActiveView() snapEnv = ["AllLines", "EDGE", "5"] arcpy.Snap_edit("Points", [snapEnv]) print "Snapped point successfully" del row, rows, mxd
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.