Determining if Layer is Point using Python Toolbox?
I think it may be as simple as changing this line:
describe = arcpy.Describe(parameters[0].value)
or maybe
describe = arcpy.Describe(parameters[0].valueAsText)
In his comment, @ian is correct about AddWarning()
being useless outside of a tool's execute()
method. I think the method you do want is setWarningMessage()
. Try this:
describe = arcpy.Describe(parameters[0].value)
if describe.shapeType in ('Point', 'Multipoint'): # catch point & multipoint
parameters[0].setWarningMessage('This is a point feature class')
else:
parameters[0].clearMessage()