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?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Dec 4, 2013 at 22:47

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

answered Dec 5, 2013 at 0:58
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.

answered Dec 4, 2013 at 23:03
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. Commented 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. Commented 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.

answered Dec 4, 2013 at 23:15
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. Commented Dec 5, 2013 at 0:34

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.