Value (arcpy)
摘要
值对象用于脚本工具的 ToolValidator 类时将从 GetParameterInfo 中返回。
属性
属性 | 说明 | 数据类型 |
isEmpty (只读) |
Indicates if the value object is empty. | Boolean |
value (读写) |
Provides the value of the value object. | String |
代码实例
值示例
UpdateParameter 将根据 NetCDF 文件的属性名称填充第二个参数的值列表。
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
相关主题
5/10/2014