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):
    if not self.params[1].altered:
        workspace=arcpy.env.workspace
        #outfc = arcpy.ValidateTableName("yl",workspace)
        unique_name = arcpy.CreateUniqueName("yl",workspace)
        self.params[1].value = unique_name

    return

  def updateMessages(self):
    """Modify the messages created by internal validation for each tool
    parameter.  This method is called after internal validation."""
    return

 

相关文章:

  • 2022-02-10
  • 2021-10-27
  • 2021-07-02
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2022-01-15
相关资源
相似解决方案