I have made a set of tools in a toolbox using ArcGIS 10.2 using the model builder.
I would like to distribute them as a tool bar, and so created a ArcGIS Python Add-In I was hoping that I could export the tools as python scripts and copy the code into the Add-In. However, it does not seem to be as simple as that.
Is it possible with Python Add-Ins to make a window for entering in parameters and run a script in the way tools/toolboxes work?
I found a useful blog post.
This is my code
import arcpy import pythonaddins import os.path class multiplebenefits(object): """Implementation for ArcGISAddin_addin.multiplebenefits (Tool)""" def __init__(self): self.enabled = True self.checked = False def onClick(self): # name of toolbox without tbx extension toolboxName = "mytoolbox" # name of tool to be executed toolName = "mymodel" # create string with path to toolbox toolboxPath = os.path.join(os.path.dirname(__file__), toolboxName + ".tbx") # call geoprocessing tool pythonaddins.GPToolDialog(toolboxPath, toolName)
But I get an error message:
Failed to open tool mymodel (mytoolbox.tbx)
TypeError: GPToolDialog() takes at most 1 argument (2 given)