0

In the ArcGIS Pro toolbox, what would be the parameter to set so that we can add a drop-down menu to choose the map frame name?

enter image description here

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Feb 7, 2023 at 9:15
1
  • Is this for a Python script tool, a Python Toolbox tool or perhaps a Model tool? Commented Feb 7, 2023 at 10:55

1 Answer 1

1

Set the params index number to the parameter for the dropdown. The zero below is for the first parameter.

def initializeParameters(self):
 # Customize parameter properties. 
 # This gets called when the tool is opened.
 aprx = arcpy.mp.ArcGISProject("CURRENT")
 map_list = [mf.name for mf in aprx.listMaps()]
 self.params[0].filter.list = map_list
 return

For map frame elements. The below assumes one Layout in the APRX.

def initializeParameters(self):
 # Customize parameter properties. 
 # This gets called when the tool is opened.
 aprx = arcpy.mp.ArcGISProject("CURRENT")
 lyt = aprx.listLayouts()[0]
 mapf_list = [mf.name for mf in lyt.listElements("MAPFRAME_ELEMENT")]
 self.params[0].filter.list = mapf_list
 return
PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
answered Feb 7, 2023 at 10:45
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.