The figure below shows a simple add-in Boundary Selections used to demonstrate this functionality. It contains a form with a selection input object and a button. When the add-in is in focus, the user can click on one or more boundaries in the graphics window to create the selection. Clicking the button triggers an
Alert with a dialog where the selected boundaries are listed.

When the add-in Settings form is added to a model, an
On load event is triggered that runs a method
createSelection. The
Settings form is shown in the figure below:

The variable selectionTag stores a unique identifier for the Model Builder
Explicit selection feature. This string needs to be different enough not to accidentally collide with the user’s selection features, used for other purposes, in the Model Builder. The figure below shows the declaration of this String variable.

In addition, a shortcut selectioninput1 is used for the selection input object, as shown in the figure below.

The figure below shows the Settings window for the
Selection Input form object
selectioninput1. Note the empty selection of the
Source and
Graphics to Use When Active. These settings are set by the method
createSelection.

When this button is clicked, a method displaySelection is run. The code for this method is shown below.