AnsweredAssumed Answered

Python Toolbox: Setting the tool Output Name and Location

Question asked by ahmadabusaleh on Mar 4, 2020
Latest reply on Mar 4, 2020 by Dan_Patterson

Hi,

I am wondering why setting up the parameter type as in output makes the tool auto -populate the output location and name without me letting me set it or control the output name.

 

I have this script that does nothing yet, but I found out that when I try to set the input of the census layer, the output is gets populated automatically with random feature class name. How can I control  at least the feature class name 

 

 

 

 

 

    def getParameterInfo(self):
        """Define parameter definitions"""
        census=arcpy.Parameter(
            name="census",
            displayName="Census Tracts",
            direction="Input",
            datatype="Feature Layer",
            parameterType="Required")

    
        output_fc=arcpy.Parameter(
            name="output_fc",
            displayName="Output",
            direction="Output",
            datatype="GPFeatureLayer",
            parameterType="Required")


        params=[census,output_fc]

        return params

 

 

    def execute(self, parameters, messages):
        """The source code of the tool."""
        census=parameters[0].value


        output_fc=parameters[1].value

 

 

Thank you,

Outcomes