I have a toolbox python script that still works in ArcMap - I am trying to updated to work in ArcPro
the script takes input parameters for
1 Site Boundary
2 Layers on Site (multiple layers)
3 Layers within distance of Site (multiple layers)
and writes to a text file summarizing layers and their visible fields that fall within or within distance of Site Boundary Feature.
where it seems to be not working in ArcPro is when it selects lyrs in the map from the input parameters. the script is completing without error messages because it is not recognizing any layers in the map that are in GetParameter inputs...
WithinLyrs = arcpy.GetParameter(1)
NearbyLyrs = arcpy.GetParameter(2)
dataF = aprx.activeMap
layers = dataF.listLayers()
lyrNum=0
for lyr in layers:
>if lyr.isFeatureLayer==1
>>if lyr in WithinLyrs or NearbyLyrs:
how is this handled differently in Pro vs Map?
Solved! Go to Solution.
did you try GetParameterAsText (you have others), and move the arcpy Current line up before the parameter list (shouldn't matter, but it might. Your layer list should be populated with the values within the project as multivalue, direction input. Using the python custom toolbox still allows you to work with a dialog and you can modify you parameters there as well
did you try GetParameterAsText (you have others), and move the arcpy Current line up before the parameter list (shouldn't matter, but it might. Your layer list should be populated with the values within the project as multivalue, direction input. Using the python custom toolbox still allows you to work with a dialog and you can modify you parameters there as well
Dan - thanks for the tips. GetParameterAsText and moving arcpy Current did not work - but the only reason why layers were being pulled from the map was to turn them on and make visible if they were in the input selection. if all layers are being added to parameters as inputs from the map this is redundant and not needed. adjusted section to just look at input parameter variables.
thanks for the tips Dan!