I have to generate line dimension annotation for our maps as a part of my daily workflow. As it stands, I've been using
round(float(!Distance!), 2)
for straight lines, then switching the selection in the table to reselect the curve lines and running
round(float(!ArcLength!), 2)
in the Field Calculator geoprocessing tool to take the raw values and round them to two digits. I am trying to figure out a way to write an if/then statement so I only have to run the geoprocessing tool once.
This if/else statement doesn't return an error, but it doesn't calculate anything to the field. I haven't been able to find an example anywhere of what I'm trying to do. I'm assuming it's impossible, but there might be something I'm missing? I don't have any other options right now but to generate text annotation, using dynamic labeling will not work for our purposes. Currently using ArcMap 10.6.
def dimCalc(Distance,ArcLength):
if (Distance == 0):
return round(float(ArcLength),2)
else:
return round(float(Distance),2)
return
statements withreturn 1
andreturn 2
, respectively, what happens then? If you replace the entire contents of yourdimCalc()
function withreturn 3
, what happens then?