How can I edit selected Attribute only with python 2.7
I want to select points in arcgis and then when I click on the button created by my python script I want the value of the selected features change automatically.
when i run the code, all the features with the value 99 changes to 4 and I want to only change the value of the features that are selected in my current mxd in ArcGIS Desktop
this is my script
import arcpy import pythonaddins
class EditFild(object):
"""Implementation for Tools_addin.EditFild_1 (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
print('int')
def onClick(self):
features = arcpy.UpdateCursor(r"D:\\SHP_test\\Point.shp")
for feature in features:
if feature.x == 99:
feature.x = 4
features.updateRow(feature)
# Works fine
print("done")
del feature,features