Value (arcpy)

Zusammenfassung

The value object is returned from GetParameterInfo when used in a script tool's ToolValidator class.

Eigenschaften

EigenschaftErläuterungDatentyp
isEmpty
(Schreibgeschützt)

Indicates if the value object is empty.

Boolean
value
(Lesen und schreiben)

Provides the value of the value object.

String

Codebeispiel

Value example

UpdateParameter populates a value list for the second parameter based on the attribute names of NetCDF file.

def updateParameters(self):
    """Modify the values and properties of parameters before internal
    validation is performed.  This method is called whenever a parameter
    has been changed."""

    # If the parameter has been altered, but not validated
    #
    if self.params[0].altered and not self.params[0].hasBeenValidated:

        # Create a NetCDFFIleProperties object based on the input and 
        #   use it to populate the value list of the sceond parameter.
        #
        netcdf = arcpy.NetCDFFileProperties(self.params[0].value.value)
        aNames = netcdf.getAttributeNames()
        self.params[1].filter.list = aNames
        self.params[1].value = aNames[0]

Verwandte Themen

9/11/2013