ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Hilfe
  • Sign Out
ArcGIS Desktop

ArcGIS Online

Die Mapping-Plattform für Ihre Organisation

ArcGIS Desktop

Ein vollständiges professionelles GIS

ArcGIS Enterprise

GIS in Ihrem Unternehmen

ArcGIS Developers

Werkzeuge zum Erstellen standortbezogener Apps

ArcGIS Solutions

Kostenlose Karten- und App-Vorlagen für Ihre Branche

ArcGIS Marketplace

Rufen Sie Apps und Daten für Ihre Organisation ab.

  • Dokumentation
  • Support
Esri
  • Anmelden
user
  • Eigenes Profil
  • Abmelden

ArcMap

  • Startseite
  • Erste Schritte
  • Karte
  • Analysieren
  • Verwalten von Daten
  • Werkzeuge
  • Erweiterungen

SetParameterAsText

  • Zusammenfassung
  • Syntax
  • Codebeispiel

Zusammenfassung

Sets a specified parameter property by index using a string value. This function is used to pass values from a script to a script tool. If you need to pass an object, such as a SpatialReference, use the SetParameter function.

Syntax

SetParameterAsText (index, text)
ParameterErklärungDatentyp
index

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

Integer
text

The string value that will set the specified parameter's property.

String

Codebeispiel

SetParameterAsText example

Pass a string to a specified tool parameter.

import arcpy

# Get the feature class from the tool.
fc = arcpy.GetParameterAsText(0)

# Determine the shape type of the feature class.
describe = arcpy.Describe(fc)

# Set tool output parameters based on shape type.
if describe.shapeType == "Polygon":
    arcpy.AddMessage("Feature Type is polygon")
    arcpy.SetParameterAsText(1, "true")  # Is polygon
    arcpy.SetParameterAsText(2, "false") # Is not line
    arcpy.SetParameterAsText(3, "false") # Is not point

elif describe.shapeType == "Polyline":
    arcpy.AddMessage("Feature Type is polyline")
    arcpy.SetParameterAsText(1, "false") # Is not polygon
    arcpy.SetParameterAsText(2, "true")  # Is line
    arcpy.SetParameterAsText(3, "false") # Is not point

elif describe.shapeType == "Point":
    arcpy.AddMessage("Feature Type is point")
    arcpy.SetParameterAsText(1, "false") # Is not polygon
    arcpy.SetParameterAsText(2, "false") # Is not line
    arcpy.SetParameterAsText(3, "true")  # Is point

else:
    arcpy.AddMessage("Unknown feature type")
    arcpy.SetParameterAsText(1, "false") # Is not polygon
    arcpy.SetParameterAsText(2, "false") # Is not line
    arcpy.SetParameterAsText(3, "false") # Is not point

Verwandte Themen

  • CopyParameter
  • GetArgumentCount
  • GetParameter
  • GetParameterAsText
  • GetParameterCount
  • GetParameterInfo
  • GetParameterValue
  • SetParameter
  • Festlegen von Parametern für Skriptwerkzeuge

ArcGIS Desktop

  • Startseite
  • Dokumentation
  • Support

ArcGIS

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

Über Esri

  • Über uns
  • Karriere
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Wir sind an Ihrer Meinung interessiert.
Copyright © 2021 Esri. | Datenschutz | Rechtliches