path = os.path.dirname(__file__)
if(len(arcpy.Describe(fc).FIDset)):
do_something()
if not(arcpy.Exists(tmp_gdb)): arcpy.CreatePersonalGDB_management(path, tmp_gdb)
fcs = arcpy.ListFeatureClasses()
for fc in fcs:
try:
arcpy.Delete_management(fc)
except:
pass
len_unit = arcpy.GetParameterAsText(#)
geodesic_formula = {"Kilometers": "!shape.geodesicLength@kilometers!", "Miles":"!shape.geodesicLength@miles!"}
expression = geodesic_formula[len_unit]
field_name = "geo"+ len_unit
arcpy.AddField_management(tmp_layer, field_name, "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
arcpy.CalculateField_management(tmp_layer, field_name, expression , "PYTHON", "")