ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

SetParameter

  • Summary
  • Syntax
  • Code sample

Summary

Sets a specified parameter property by index using an object. This function is used to pass objects from a script to a script tool. If you need to pass a string, use the SetParameterAsText function.

Syntax

SetParameter (index, value)
ParameterExplanationData Type
index

The specified parameter's index position in the parameter list.

Integer
value

The object that will set the specified parameter's property.

Object

Code sample

SetParameter example

Pass an object to a specified tool parameter.

import arcpy

# Get the input feature class name.
fc = arcpy.GetParameterAsText(0)

# Obtain the spatial reference object and return it to the tool.
spatial_ref = arcpy.Describe(fc).spatialReference
arcpy.SetParameter(1, spatial_ref)

Related topics

  • CopyParameter
  • GetArgumentCount
  • GetParameter
  • GetParameterAsText
  • GetParameterCount
  • GetParameterInfo
  • GetParameterValue
  • SetParameterAsText
  • Setting script tool parameters

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal