# Including float value in loop processing of Surface Volume tool using ArcMap ModelBuilder

How do I use the Surface Volume tool in ArcMap via Model Builder, without using Python, to process a set of multiple float values in a loop, since an iterator takes integers when I implement a for loop?

See the attached image as indication. An alternative method is to create a table and store your floats in that, 1 row per float value. Then use the Iterate Field Value iterator to drive your model. But I think @user2856 has the simplest solution.

• the issue in here is that for both options, iterate multivalue and iterate field value it is not possible connect it to the so called "plane height" - which is the field of the tool i'd like apply multiple values to
– Olli
Jul 21, 2020 at 15:09
• Try parsing the output of the iterator into a Double using the Calculate Value tool, then feed that into the volume tool Jul 21, 2020 at 18:59
• Thanks, thats exactly what I was looking for! :)
– Olli
Jul 22, 2020 at 7:45

You can use the Iterate Multivalue tool and add a list of floats: Here is the code to loop the surface volume tool. You can hard-code the paths and run this in your favourite IDE. Or un-comment the arcpy.GetParameter....stuff and turn this into a Toolbox Tool.

``````try:
import sys, arcpy, traceback
arcpy.CheckOutExtension("3D")

arcpy.AddMessage("Loop the 3D Analyist Surface Volume tools for a range of values...")

def GetValues(themessage, x):
thevaluesatx = str(x)
themessage = themessage.split("\n")
thevalues = themessage.split("  ")
for item in thevalues:
thevalue = item.split("=")
thevalue = thevalue[-1]
thevaluesatx = thevaluesatx + "," + str(thevalue)
thevaluesatx = thevaluesatx +"\n"
return thevaluesatx

My_txt = r"F:\FerndaleDirtPile20190729\ferndaledirtpipe20190729demUTMvolumes.csv"
My_surface= r"F:\FerndaleDirtPile20190729\ferndaledirtpipe20190729demUTM.tif"
direction = "ABOVE"
startingplane = 4
endingplane = 10.4
z = 1

#My_surface= arcpy.GetParameterAsText(0)
#My_txt = arcpy.GetParameterAsText(1)
#direction = arcpy.GetParameterAsText(2)
#startingplane = float(arcpy.GetParameterAsText(3))
#z = float(arcpy.GetParameterAsText(4))
#endingplane = float(arcpy.GetParameterAsText(6))

direction  = direction.upper()
f = open(My_txt,'a')
f.writelines(r"elevation, 2d_area, 3d_area, volume" + "\n")

if direction == "BELOW":

while startingplane > endingplane:
result = arcpy.SurfaceVolume_3d(My_surface, "", direction, startingplane)
thevaluesatx = GetValues(result.getMessages(0), startingplane)
f.writelines(thevaluesatx)

if direction == "ABOVE":
x = startingplane
while startingplane < endingplane:
result = arcpy.SurfaceVolume_3d(My_surface, "", direction, startingplane, z)
thevaluesatx = GetValues(result.getMessages(0), startingplane)
print thevaluesatx
f.writelines(thevaluesatx)

f.close()

except arcpy.ExecuteError:
msgs = arcpy.GetMessages(2)