I have been attempting to make a Tool within a Toolbox with four different parameters. My code consists of the following:
def getParameterInfo(self): """Define parameter definitions""" # First parameter = layer with customized features source = arcpy.Parameter( displayName = "Source layer with customized features", name = "source", datatype = "Feature Layer", parameterType = "Required", direction = "Input") # Second parameter = layers to which customized features will be applied updlayers = arcpy.Parameter( displayName = "Layers with features to be updated", name = "updlayers", datatype = "GPValueTable", parameterType = "Required", direction = "Input") labelFontSize = arcpy.Parameter( displayName = "Label Font Size", name = "labelFontSize", datatype = "GPDouble", parameterType = "Required", direction = "Input") labelBoldFont = arcpy.Parameter( displayName = "Bold Font:", name = "labelBoldFont", datatype = "GPDouble", parameterType = "Required", direction = "Input") updlayers.columns = [['Feature Layer', 'Features']] params = [source,updlayers,labelFontSize,labelBoldFont] return params
From my understanding, the params list is the list that will later be included as one of the inputs into my execute function. A portion of my execute function is as follows:
def execute(self, parameters, messages): for a in range(0,len(parameters)): arcpy.AddMessage("This is the item at index " + str(a) + " " + parameters[a].name) updlayers = parameters.values labelFontSize = parameters.value
Hence, params from getParameterInfo() will be parameters in the execute function. Is that correct? Either way, I am having trouble with my last parameter, labelBoldFont. I essentially want this to be a checkbox in my tool so that the user can choose to have their label text to be bold or not. However, the parameters list in my execute() function only has three elements and not four (labelBoldFont is not being included in the list???). I have done some thorough testing and I can't seem to find the issue with my code. Any ideas as to what the source of the problem would be?