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."""
try:
if self.params[0].value and not self.params[0].hasBeenValidated:
# clear the other parameters upon change of input layer
self.params[1].value = ""
rootDir = str(self.params[0].value)
if os.path.isdir(rootDir) and rootDir.find('gdb') == -1 :
#self.params[2].enabled = True
#self.params[3].enabled = False
valLst = []
rootLst = os.listdir(rootDir)
for e in rootLst:
if os.path.isdir(rootDir + os.sep + e) and len(e) == 5:
if os.path.isdir(rootDir + os.sep + e) and len(e) == 5:
arcpy.env.workspace = (rootDir + os.sep + e)
fLst = arcpy.ListFeatureClasses()
fStr = str(fLst)
if fStr.find('_a.shp') <> -1 and fStr.find('_b.shp') <> -1\
and fStr.find('_c.shp') <> -1 and fStr.find('_d.shp') <> -1\
and fStr.find('_l.shp') <> -1 and fStr.find('_p.shp') <> -1:
if not e.upper() in valLst:
valLst.append(e)
valLst.sort()
self.params[1].filter.list = valLst
except:
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
#self.params[2].value = tbinfo + " \n" + str(sys.exc_type) + ": " + str(sys.exc_value)
#self.params[4].value = "_".join(valList)
return
Special_Features_Validation.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录