arcpy.Parameter : how to create "The interactive feature input control"?

Jump to solution
11-15-2019 04:23 AM
New Contributor III

(ArcMap 10.5, but help pages I am referring are the same as in 10.7)

I am trying to make a GP tool within Python toolbox with kind of selection input: user selects features in ArcMap interactively.

I was reading
Using the interactive feature and record input controls—Help | ArcGIS Desktop 

which show that it's possible for GP tool to have such kind of parameter. Quote: "The interactive feature input control gives you two methods for inputting features to a tool—either by clicking on a map display or by providing an existing dataset."

OK, so I check what parameter types I can create here:
Defining parameter data types in a Python toolbox—Help | ArcGIS Desktop 

and it seems that Feature Set (GPFeatureRecordSetLayer)  is what I am looking for as description says: "Interactive features that draw the features when the tool is run.".

So here is my magic tool, but I do not see any way to "enter features interactively":

class AttachTool(object):
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Add attachments"
        self.description = "Adds the same file as attachment to multiple selected features"
        self.canRunInBackground = False

    def isLicensed(self):
        """Set whether tool is licensed to execute."""
        return True

    def getParameterInfo(self):
        """Define parameter definitions"""

        paramInputFeatures = arcpy.Parameter(
            displayName="Input Features",
            datatype="GPFeatureRecordSetLayer", # Interactive features that draw the features when the tool is run
            multiValue = True)

        paramInputFile = arcpy.Parameter(
            displayName="File to attach",

        return [paramInputFeatures, paramInputFile]

    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""

    def updateMessages(self, parameters):
        """Modify the messages created by internal validation for each tool
        parameter.  This method is called after internal validation."""

    def execute(self, parameters, messages):
        """The source code of the tool."""
        arcpy.AddMessage('Just pretending to do something...')

Input field looks like this and I don't see how I should select features...
How the tool input looks like

0 Kudos
1 Solution

Accepted Solutions
MVP Regular Contributor
5 Replies
MVP Regular Contributor


New Contributor III

Do you suggest better to re-post in Python group?

0 Kudos
MVP Regular Contributor

No.   I was just getting more eyes on this for you by mentioning the group.  

New Contributor III

It seems that I misunderstood what "interactive input" means according to the help from Canada in the mentioned thread on

So the question is a simple one now: Is it possible to create a GP tool with input that accepts selected features in ArcMap? (I will create a new question for this)

0 Kudos