Hi,
I build a new geoprocessing tool, and I want to set a default outputCoordinateSystem in Environment:
I found we have it tool parameters:
I tried to use initializeParameters:
class ToolValidator:
  # Class to add custom behavior and properties to the tool and tool parameters.
    
    def __init__(self):
        # Set self.params for use in other validation methods.
        self.params = arcpy.GetParameterInfo()
    def initializeParameters(self):
        # Customize parameter properties. This method gets called when the
        # tool is opened.
        for param in self.params:
            if param.name == "outputCoordinateSystem":
                param.value = arcpy.SpatialReference(2230)
        returnbut it didn't work out.
Could you, please, help me?
Your parameter name is the Name field. that is not 'outputCoordinateSystem' in your screenshot, but 'output_feature...'
You can also just manually set the environment variable using arcpy.env:
import arcpy
...
def main():
    arcpy.env.outputCoordinateSystem = arcpy.SpatialReference(2230)
    ...Thank you for the answer.
Yeah, I am still confused how to set the Environment parameter. Therefore, I could not accept the answer.
Currently, I use:
def main():
 
    with arcpy.EnvManager(outputCoordinateSystem='PROJCS["California_...'):
        arcpy.management.CopyFeatures(path, outpath)