![]() The new directory structure for the distribution should be the following: The esri directory and file layout should be the following: ![]() Using ArcCatalog or the Catalog window, copy the files into the esri/toolboxes directory that exists in the distribution structure. xml files must be copied over from the directory where it was created. chm) has been created, it and its accompanying. Once the SamplePythonToolbox.pyt is created and the side-panel help has been configured for the toolbox through the metadata edited in the Item Description context menu or a custom compiled help file (. This is an effective way of distributing custom Python code as a module and exposing its functionality through ArcGIS geoprocessing tools. In the SamplePythonToolbox.pyt, the foo module has been imported and the execute method of the SampleTool class has called the hello function from the foo module. getenv ( "username" ) + " welcome to the sample tool" ) foo. This method is called after internal validation.""" return def execute ( self, parameters, messages ): """The source code of the tool.""" messages. This method is called whenever a parameter has been changed.""" return def updateMessages ( self, parameters ): """Modify the messages created by internal validation for each tool parameter. canRunInBackground = False def getParameterInfo ( self ): """Define parameter definitions""" params = None return params def isLicensed ( self ): """Set whether tool is licensed to execute.""" return True def updateParameters ( self, parameters ): """Modify the values and properties of parameters before internal validation is performed. tools = class SampleTool ( object ): def _init_ ( self ): """Define the tool (tool name is the name of the class).""" self. alias = "SampleToolbox" # List of tool classes associated with this toolbox self. Import arcpy import os import foo class Toolbox ( object ): def _init_ ( self ): """Define the toolbox (the name of the toolbox is the name of the. For additional information on creating and working with Python toolboxes, see Creating a new Python toolbox. ![]() Through the creation of a new Python toolbox named SamplePythonToolbox, the entire process of extending geoprocessing through Python modules can be demonstrated. The toolbox and tool labels categories override files are located in the esri/help/gp/toolboxes directory. These message files are used within the Python toolboxes for messages that need to be internationalized. ![]() The esri/help/gp/messages directory is where any geoprocessing message (. The naming convention for the toolbox is _toolbox.xml and the naming convention for each tool is _.xml. xml) for custom toolboxes and tools are stored. The esri/help/gp directory is where the toolbox and tool metadata (. pyt) are placed in the esri/toolboxes directory along with any supporting scripts if using script tools. The following is the directory structure for the English language:Ĭustom toolboxes (. The esri directory contains the custom toolboxes along with their associated help files. ArcGIS Desktop will search within the Python site-packages location to see if a directory named esri exists within each module. In addition, this allows the custom toolbox module to take advantage of the well-established methodology that ArcGIS system toolboxes have for message distribution, language-based help, and response to localized settings. As a system toolbox, it is readily accessible in the list of system toolboxes within ArcGIS and can have ArcPy wrappers created for extending ArcPy as well. This process can be further implemented to extend geoprocessing functionality by adding custom toolboxes and/or Python toolboxes directly to the ArcGIS system toolboxes. Once the foo module is installed or copied into the site-packages directory, the structure should be the following: If there are user restrictions in place that prohibit running an executable, copying the foo directory from the build/lib directory to the site-packages directory will produce the same effect as installing it through the executable. As an alternative to running the executable to install the foo module, the foo directory can also be copied directly from the build/lib directory into the Python site-packages directory. This is an executable that can be distributed in order to install the foo module to the Python site-packages directory on a Windows machine. In the dist directory, foo-1.0.win32.exe is created. The Windows builder creates dist and build directories in the src directory.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |