I want to make a python script where I put for input multiple layer's and to apply a buffer for every input. I want every buffer to put another distance. After I put the input layer's to appear another window where to specify the distance for buffer. It's possible?
import arcpy
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Toolbox"
self.alias = "toolbox"
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Tool"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
Layers=arcpy.Parameter(
displayName="Layers",
name="Layer",
direction="Input",
parameterType="Required",
datatype="GPFeatureLayer",
multiValue="True")
parameter = [Layers]
return parameter
def execute(self, parameter, messages):
"""The source code of the tool."""
parameter=params[0].valueAsText
You could use a ValueTable with one column for the layers and one for the buffer distance
Creating value table parameters
def getParameterInfo(self):
"""Define parameter definitions"""
params = []
param = arcpy.Parameter(
displayName='Buffer Layer',
name='buffer',
datatype='GPValueTable',
parameterType='Required',
direction='Input')
param.columns = [['GPFeatureLayer', 'Input Features'], ['GPDouble', 'Buffer Distance']]
params.append(param)
return params