I have a simple add-in script for Arcmap 10.1 to create a toolbar, select a layer from a drop down list of the current layers in the project, buffer that layer four-miles, then use the resulting four-mile buffer output as an input for a six-mile outside buffer. I have a work flow where I repeatedly need to create a four-mile buffer with a six-mile outside buffer surrounding this. Everything functions up to and including the four-mile buffer layer creation, but I get no six-mile outside buffer being created. I have been working with ESRI support but having trouble resolving this. Any ideas?
import arcpy
import pythonaddins
import os
class ComboBoxClass1(object):
"""Implementation for DataRequestBuffer_addin.combobox (ComboBox)"""
def __init__(self):
self.editable = True
self.enabled = True
self.dropdownWidth = 'WWWWWWWWWWWWWWWWWWWW'
self.width = 'WWWWWWWWWWWWWWWWWWWW'
def onSelChange(self, selection):
arcpy.env.overwriteOutput = True
# When a new layer is selected, create a 4 mile buffer around that layer then create a 6 mile buffer surrounding the outside of the 4 mile buffer.
layer = arcpy.mapping.ListLayers(self.mxd, selection)[0]
outPath = os.path.dirname(layer.dataSource)
print outPath
# Buffer 4 miles
print 'Buffering %s with 4 mile buffer' % layer
arcpy.Buffer_analysis(layer, outPath + os.sep + str(layer) + "_4milebuff", "4 Miles", "FULL", "ROUND", "ALL", "")
buff6 = outPath + os.sep + str(layer) + "_4milebuff"
# Buffer 6 miles surrounding outside of 4 mile buffer
print 'Buffering %s with 6 mile outside buffer' % buff6
arcpy.Buffer_analysis(buff6, outPath + os.sep + str(layer) + "_6milebuffoutside", "6 Miles", "OUTSIDE_ONLY", "ROUND", "ALL", "")
arcpy.RefreshActiveView()
def onEditChange(self, text):
pass
def onFocus(self, focused):
# When the combo box has focus, update the combo box with the list of layer names.
if focused:
self.mxd = arcpy.mapping.MapDocument('current')
layers = arcpy.mapping.ListLayers(self.mxd)
self.items = []
for layer in layers:
self.items.append(layer.name)
def onEnter(self):
pass
def refresh(self):
pass