2

I'm working within ArcToolbox. I understand how to create toolboxes and the scripts that accompany them. Most toolbox scripts have a validation script. (Right click tool -> Properties -> Validation tab).

I have created a tool using ModelBuilder that runs very similar to the Strip Map Index Features tool(Cartography Tools -> Data Driven Pages - > Strip Map Index Features). I have just added a few more fields to the attribute table.

Is it possible to include / create a validation script for tools built using ModelBuilder?

3 Answers 3

2

I would write a Python script that checks the model inputs, returning True or False. Then create a script tool for the script. You can drop this tool into your model, as the first node. This basically mimics the validation class of a Python script tool. You can add as many functions and classes as you need, import any module too. Add a script to a model

2

The Understanding validation in script tools page implies that customizing tool validation is only available to Python script tools in regular toolboxes and the tools you write as Python classes in Python (only) toolboxes.

It should be possible to write a Python script tool (or a tool in a Python toolbox) that takes parameters, does the validation and then runs your tool which is a model using those parameters i.e. wrap your model tool within a Python tool.

2
  • Oh wow. I see, so I guess there wouldn't be a way to create a validation script for tools built using odel builder. Thanks. Dec 4, 2013 at 23:06
  • All script tools, whether Python or not, have a validation class that can be edited. The Python script tool can be extended or customized more.
    – klewis
    Dec 5, 2013 at 0:28
-1

You could also just build the process in model builder. Then use the model builder option of export model to python scrip. Then load that newly created python script as a python script tool (which you could write validation code for).

Maybe not exactly what you were going for, but it's the closest I can think of other than @PolyGeo's suggestion of basically creating a wrapper python script tool that would call the model.

1
  • I would advise against doing it this way because the Python script exported from a model is not guaranteed to run without what can sometimes be a considerable code overhaul.
    – PolyGeo
    Dec 5, 2013 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.