我目前在脚本参数
中的从获取属性时遇到问题当我点击 Obtained From 面板时,它应该显示一个下拉列表(在这里我用来从数据集数据类型中获取东西)。
但现在我不能再这样做了
我甚至无法编辑我之前使用过的参数中所选的 。
我想知道是什么原因造成的?我需要快速解决它......
我认为这是在编辑脚本属性中的验证标签后发生的。
默认情况下应该显示如下
import arcpy
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
return
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."""
return
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
然后我将其编辑为此,因此我可以从列
获取特定值import arcpy
class ToolValidator(object):
"""Class for validating a tool's parameter values and controlling
the behavior of the tool's dialog."""
def __init__(self):
"""Setup arcpy and the list of tool parameters."""
self.params = arcpy.GetParameterInfo()
def initializeParameters(self):
"""Refine the properties of a tool's parameters. This method is
called when the tool is opened."""
return
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 self.params[1].value and self.params[2].value:
self.params[3].filter.list = sorted({row[0] for row in arcpy.da.SearchCursor(self.params[1].value, self.params[2].value.value) if row[0]})
def updateMessages(self):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
Dunno如果触发了某些东西,我已经恢复了变化,但没有任何作用......我是否点击了其他内容?我不这么认为