I am adapting a custom Python toolbox from ArcMap to ArcGIS Pro which assigns land use codes to parcels. This specific tool is for a special "Uncodable" label, so there is no user input besides clicking run.
In ArcMap, the code parameter appears filled in with the default value, but not editable:
I would like to know if there is a way to do the same in Pro: can I have the parameter be visible, but disabled so it can't be changed?
I want this so coders can do a visual check that Yes, this is the right code that I want to apply. If it's not possible to do that, is there a way to just put descriptive text in the Parameters pane saying "You are going to code it such and such"? Or can I add a message that no action is required? Since there is a parameter, but disabled, I can't even get the "no parameters" message.
Thank you!
Solved! Go to Solution.
would a derived parameter work?
Setting script tool parameters—ArcGIS Pro | Documentation
you can use SetParameterAsText or SetParameter there
would a derived parameter work?
Setting script tool parameters—ArcGIS Pro | Documentation
you can use SetParameterAsText or SetParameter there
As Dan said, you could set it to Derived, that will show the "No parameters" message.
Alternatively, you can just reset the parameter's value in the updateParameters() method:
class Tool(object):
def __init__(self):
self.label = "Tool"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
return [
arcpy.Parameter(name="code", displayName="Land Use Code", datatype="GPString", parameterType="Required", direction="Input")
]
def updateParameters(self, parameters):
parameters[0].value = "9999 - Not Classifiable"
def updateMessages(self, parameters):
parameters[0].setWarningMessage("This parameter is for information only, you can't edit it.")
def execute(self, parameters, messages):
return
With a custom python toolbox, you can set the above within the tool dialog