AnsweredAssumed Answered

how to pass a variable to a python script in model builder

Question asked by geonetadmin on Feb 14, 2011
Latest reply on Feb 15, 2011 by geonetadmin
Original User: frankv3

how do you send the results of geoprocessing tools in model builder to a python script that has been added to the model?
The model fails for some reason, but it doesn't say why in the results

this is the script:


# Import arcpy module
import arcpy
import sys
import os
import types

# Load required toolboxes
arcpy.ImportToolbox("Model Functions")

# Script arguments
AltNum = arcpy.GetParameterAsText(0)
DXFWorkspace = arcpy.GetParameterAsText(1)



# Process: Get Field Value
SX = arcpy.GetFieldValue_mb(Parcel_XY_View, "X_COORD", "Double", "0")

# Process: Get Field Value (2)
SY = arcpy.GetFieldValue_mb(Parcel_XY_View, "Y_COORD", "Double", "0")

X1 = SX - 1000
Y1 = SY - 1000
X2 = SX + 1000
Y2 = SY + 1000

coord = ('-1000.000000,-1000.00000 %s,%s' + '\n' + '1000.00000,1000.00000 %s,%s')%(X1,Y1,X2,Y2)

Afile = r"%s\%s.wld"%(DXFWorkspace,AltNum)
Wfile =  file(Afile, 'w')
Wfile.write(coord)
Wfile.close()

Attachments

Outcomes