Hello Everyone,
I have a model which runs the calculate value tool:
The code in the tool is:
When the model runs the following errors are displayed:
I'm not sure what the errors are related to. What's strange is that the code does seem to execute: it displays the extent of the site_polygon layer, sets the scale to 1:4000, then creates the JPG file.
Any insights appreciated. Thanks!
return 'true' perhaps return True
boolean is not a string
Just wondering why you would want to use the ModelBuilder for this. It would be a lot more stable if you would create a script (and if necessary a tool from the script) to do this.
Actually, that would be my preference. I just haven't figured out yet how to pass a parameter from a model to a script. As you see I need to pass in a parameter LocNo.
Can you point me to an example that would help me figure out how to do that? I would still need to make it part of a script tool as this is part of a larger model.
Thanks Xander!
I think that if you can create this variable in your model, you will also be able to create it within a script. I wouldn't include ModelBuilder at all, but I'm note sure what the content of LocNo is and what it is based on.
LocNo is just a string value that would be provided by the end user.
Thanks
Then there would be no problem to use a script instead of a a model. The script should also check for existence of the MXD file before you try to open it (especially if it is a string provided by a user).
So would the code in the script be the same as what I put in the Calculate Value tool and does the passing the parameter part get handled in properties > parameters when I create the script tool?
Great, thanks very much Xander.