Create a model tool

A geoprocessing model is saved as a model tool in a toolbox. Model tools can be run like any other geoprocessing tool from the Geoprocessing pane and used in other models and Python scripts. You can configure a model tool so you can process different datasets with different settings than those specified inside the model, without actually modifying the model variables in ModelBuilder.

To create a model tool, do the following:

  • Build and save a model within ModelBuilder.
  • Set model parameters.
  • Set model tool properties.
  • Document the tool.

Model parameters

If you built your model without setting any model parameters, when you open the model tool in the Geoprocessing pane, the tool dialog box will display no parameters.

Model tool with no parameters
At this point, you may run the tool, and the data and settings hard-coded in the model will be used. No output datasets will be added to a map.

To display parameters on the tool dialog box, and to add output datasets to a map, you must set model parameters within your model. Once the model parameters have been created, you can run the model as a geoprocessing tool, supplying different values and datasets for its parameters.

Learn more about model parameters
Model parameters

Intermediate data

When you run a model, output data is created for each process in the model (unless the process only modifies the input). Some of the data created is of no use after the model is run since it was only created to connect to another process that creates new output. Such data is called intermediate data. When a model tool is run from the Geoprocessing pane, all intermediate output data is automatically deleted when the tool completes, except datasets from model output parameters.

You can use the in_memory workspace as a location for intermediate data in your model. If you plan to share the model, or use the model on a different system, all intermediate data should use an in_memory output path, or use inline variable substitution to a workspace environment path to ensure that the output directory exists for intermediate data that is created. For example, an intermediate output feature class should use a path such as %scratchgdb%\intermediateBuffers.

Variables and tool parameters

You may need to expose additional tool parameters as model variables to set your model parameters. Model variables are automatically created for the input and output datasets of a tool, but not for any other tool parameters. To add additional model variables so you can set them as model parameters, right-click any tool, select Create Variable, then select the desired tool parameter or environment. Alternatively, click ModelBuilder > Insert > Variable, choose a data type, click OK, and connect the new variable to a tool or use it for inline variable substitution.

Model properties

When you open a model tool in the Geoprocessing pane, the model tool's label is displayed at the top of the pane. You can change this and other model tool properties, such as the order of parameter display, by right-clicking the model tool in a toolbox and selecting Properties.

Learn more about model properties

Document the tool

An important part of creating a good model tool is writing help documentation that will allow others to understand and use your tool efficiently. You write help documentation for a tool by modifying its metadata. Right-click the model tool in its toolbox, select View Metadata, and click the Description > Edit button in the tab.

Learn more about documenting a tool

In addition to the standard documentation you write for your model tool, follow these recommendations to make your model diagrams straightforward to read and follow:

  • Rename variables and tools so they have context within the model.
  • Make the model layout (how elements are arranged) readable. Use the ModelBuilder > View > Auto layout command, or move the elements manually to make a model straightforward to follow.
  • Add element and diagram labels.
  • Expose geoprocessing environments you set in the model as model variables. This way, a user can easily see which environments affect the model.