ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • ヘルプ
  • Sign Out
ArcGIS Desktop

ArcGIS Online

組織のマッピング プラットフォーム

ArcGIS Desktop

完全なプロ仕様の GIS

ArcGIS Enterprise

エンタープライズ GIS

ArcGIS for Developers

位置情報利用アプリの開発ツール

ArcGIS Solutions

各種業界向けの無料のテンプレート マップおよびテンプレート アプリケーション

ArcGIS Marketplace

組織で使えるアプリとデータを取得

  • ドキュメント
  • サポート
Esri
  • サイン イン
user
  • マイ プロフィール
  • サイン アウト

Help

  • ホーム
  • はじめに
  • マップ
  • 解析
  • データ管理
  • ツール
  • その他...

SetParameterAsText

  • サマリー
  • 構文
  • コードのサンプル

サマリー

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

構文

SetParameterAsText (index, text)
パラメーター説明データ タイプ
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

コードのサンプル

SetParameterAsText example

Pass text string to specified tool parameter.

import arcpy

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

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

# Set tool output parameters based on shape type.
# 
if dscFC.ShapeType.lower() == "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 dscFC.ShapeType.lower() == "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 dscFC.ShapeType.lower() == "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

関連トピック

  • CopyParameter
  • GetArgumentCount
  • GetParameter
  • GetParameterAsText
  • GetParameterCount
  • GetParameterInfo
  • GetParameterValue
  • SetParameter
  • スクリプト ツール パラメータの設定

ArcGIS Desktop

  • ホーム
  • ドキュメント
  • サポート

ArcGIS プラットフォーム

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

Esri について

  • 会社概要
  • 採用情報
  • Esri ブログ
  • ユーザ カンファレンス
  • デベロッパ サミット
Esri
ご意見・ご感想をお寄せください。
Copyright © 2019 Esri. | プライバシー | リーガル