My version of QGIS is 2.8.3
I have a tool which takes parameters like this:
##Input_Vector_Layer=vector
##Input_Raster_Layer=raster
##Distance=number 1.0
##Height=field Input_Vector_Layer
# Do Something...
Is it possible to make the fourth parameter optional?
Answer
If it's not a problem for you, my idea is to add a Boolean
:
##Input_Vector_Layer=vector
##Input_Raster_Layer=raster
##Distance=number 1.0
##Height=field Input_Vector_Layer
##Use_Optional_Field=Boolean True
and the directly check for its value:
check = Use_Optional_Field
if check:
# Do something...
else:
# Do something else
No comments:
Post a Comment