Résumé
A Value object is returned from GetParameterInfo when used in a script tool's ToolValidator class, and from the GetParameter function depending on the parameter type.
Propriétés
Propriété | Explication | Type de données |
isEmpty (Lecture seule) | Indicates whether the value object is empty. Remarque :If a parameter has no value, the parameter's value property will return a NoneType and the isEmpty property will be inaccessible. To determine whether a parameter has a value, use an if check against the Parameter value property, for example, if param.value:. | Boolean |
value (Lecture et écriture) | Provides the value of the value object. | String |
Exemple de code
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.
net_cdf = arcpy.NetCDFFileProperties(self.params[0].value.value)
att_names = net_cdf.getAttributeNames()
self.params[1].filter.list = att_names
self.params[1].value = att_names[0]
return
Rubriques connexes
Vous avez un commentaire à formuler concernant cette rubrique ?