Hi Majdoleen Awadallah
I see that you have one error in the script which is something normal since you are learning python scripting.
-You created a function called shift_features but you didn't call it in your script. the function is there sitting in your script but the tool will not execute it because it's not called.
here is a small edit that will make the tool works:
import arcpy
Feature = arcpy.GetParameterAsText(0)
X_Value = arcpy.GetParameterAsText(1)
Y_Value = arcpy.GetParameterAsText(2)
def shift_features(Feature, X_Value=None, Y_Value=None):
"""
Shifts features by an x and/or y value. The shift values are in
the units of the in_features coordinate system.
Parameters:
in_features: string
An existing feature class or feature layer. If using a
feature layer with a selection, only the selected features
will be modified.
X_Value: float
The distance the x coordinates will be shifted.
Y_Value: float
The distance the y coordinates will be shifted.
"""
with arcpy.da.UpdateCursor(Feature, ['SHAPE@XY']) as cursor:
for row in cursor:
cursor.updateRow([[row[0][0] + (X_Value or 0),
row[0][1] + (Y_Value or 0)]])
return
shift_features(Feature,X_Value,Y_Value)
Thanks,