a guest Dec 11th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- THIS SCRIPT DIVIDES 1 BY 2 AND (ATTEMPTS TO) REPORT THE RESULTS IN SEVERAL WAYS
- To create an ArcToolbox tool with which to execute this script, do the following.
- 1 In ArcMap > Catalog > Toolboxes > My Toolboxes, either select an existing toolbox
- or right-click on My Toolboxes and use New > Toolbox to create (then rename) a new one.
- 2 Drag (or use ArcToolbox > Add Toolbox to add) this toolbox to ArcToolbox.
- 3 Right-click on the toolbox in ArcToolbox, and use Add > Script to open a dialog box.
- 4 In this Add Script dialog box, use Label to name the tool being created, and press Next.
- 5 In a new dialog box, browse to the .py file to be invoked by this tool, and press Next.
- 6 In the next dialog box, press Finish.
- 7 To later revise any of this, right-click to the tool's name and select Properties.
- # Import necessary modules
- import sys, os, string, math, arcpy
- # Define two floating-point literals
- theNumerator = 1.0
- theDenominator = 2.0
- # Report those literals noting the use of \n and str()
- arcpy.AddMessage( '\n' + str(theNumerator) + \
- ' is to be divided by ' + str(theDenominator) + ',' )
RAW Paste Data