Hello,
I've created a python toolbox that allows a user to select geometries on a map as input to the tool. It works, except even after assigning a value as I am here, when I run the tool it still has a dropdown of map layers with none selected by default. Am I doing something wrong in assigning the value of the parameter?
input_parcels = arcpy.Parameter(
name='input_parcels',
displayName='Input Parcels',
datatype='GPFeatureRecordSetLayer',
parameterType='Required',
direction='Input'
)
aprx = arcpy.mp.ArcGISProject('Current')
mp = aprx.listMaps('Map')[0]
lyr = mp.listLayers('parcel_shapefiles')[0]
input_parcels.value = lyr
What on earth are you talking about? I use a "proper IDE" and it doesn't raise any warnings or errors. If all you're doing is commenting to show your contempt and can't even provide useful feedback on how to solve the issue, you shouldn't be commenting.
Hi, this is weird.
I just tested it myself and had the same thing happen. Interestingly enough, if you change it to GPFeatureLayer, the default runs no problem.
So, I'm not sure of your workflow, but if you don't need the interactivity, maybe try GPFeatureLayer instead?
Thanks for checking on your end - I might reach out to ESRI tech support to see if it's a bug. Unfortunately the interactive element is a hard requirement. It isn't a huge deal, because it just means the user needs to select from the drop down as an extra step, I just wanted to make it more seamless and avoid the potential for user error.