Attribute calculation from model builder parameter

Discussion created by rcmiedema on Jul 11, 2011
Latest reply on Jul 11, 2011 by rcmiedema
I have made a model that includes a script to insert new objects in a line feature class together with some attributes. One of the attributes is a string that can have two possible values to be defined by the user executing the tool. I have defined this as a model parameter and defined "Value List" with the possible values.
In the script I defined a variable that will use the user defined value. In the InsertCursor different attributes are updated without any problem. However the attribute that should obtain the value of the variable does not get any value.

ArcGIS 9.3.1 / Python 2.5

# Import system modules
#import sys, string, os, arcgisscripting
import sys, time, string, os, arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Load required toolboxes...
gp.AddToolbox("c:/Archivos de programa/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

# Script arguments...
colectoresLineas = gp.GetParameterAsText(0)
readTable = gp.GetParameterAsText(1)
tipoDigi =  gp.GetParameterAsText(2)

rows = gp.searchcursor(readTable)
insertCur = gp.InsertCursor(colectoresLineas)

# Get the first feature in the searchcursor
lineArray = gp.CreateObject("Array")
pnt0 = gp.CreateObject("Point")
pnt1 = gp.CreateObject("Point")

row = rows.next()
while row:
        coordX0 = row.NEAR_X
        coordY0 = row.NEAR_Y
        coordX1 = row.POINT_X
        coordY1 = row.POINT_Y
        pnt0.id = 0
        pnt0.x = coordX0
        pnt0.y = coordY0
        pnt1.id = 1
        pnt1.x = coordX1
        pnt1.y = coordY1
        feat = insertCur.NewRow()
        feat.shape = lineArray
        feat.ESTAD_UTIL = "SC"
        feat.TIPO_DIGI = tipoDigi
        row = rows.next()

del rows, row