ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Справка
  • Sign Out
ArcGIS Desktop

ArcGIS Online

Картографическая платформа вашей организации

ArcGIS Desktop

Полноценная профессиональная ГИС

ArcGIS Enterprise

ГИС предприятия

ArcGIS Developers

Инструменты для встраивания приложений с местоположениями

ArcGIS Solutions

Бесплатные шаблоны карт и приложений для отрасли

ArcGIS Marketplace

Получение приложения и данных для вашей организации.

  • Документация
  • Поддержка
Esri
  • Войти
user
  • Мой профиль
  • Выход

ArcMap

  • На главную
  • Начало работы
  • Карта
  • Анализ
  • Управление данными
  • Инструменты
  • Дополнительные модули

Шаблон набора инструментов Python

При создании нового набора инструментов Python используется представленный ниже шаблон. Этот код создает набор инструментов Python в классе Toolbox, содержащим один инструмент Tool. Класс Tool следует переименовать, после чего его можно дублировать и изменять для создания дополнительных инструментов в наборе инструментов Python.

В качестве альтернативы можно скопировать следующий код и вставить его в новый файл .pyt.

import arcpy
class Toolbox(object):
    def __init__(self):
        """Define the toolbox (the name of the toolbox is the name of the
        .pyt file)."""
        self.label = "Toolbox"
        self.alias = ""
        # List of tool classes associated with this toolbox
        self.tools = [Tool]
class Tool(object):
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Tool"
        self.description = ""
        self.canRunInBackground = False
    def getParameterInfo(self):
        """Define parameter definitions"""
        params = None
        return params
    def isLicensed(self):
        """Set whether tool is licensed to execute."""
        return True
    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""
        return
    def updateMessages(self, parameters):
        """Modify the messages created by internal validation for each tool
        parameter.  This method is called after internal validation."""
        return
    def execute(self, parameters, messages):
        """The source code of the tool."""
        return

Связанные разделы

  • Создание нового набора инструментов Python
  • Что такое набор инструментов Python?

ArcGIS Desktop

  • На главную
  • Документация
  • Поддержка

ArcGIS

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

Об Esri

  • О нас
  • Карьера
  • Блог Esri
  • Конференция пользователей
  • Саммит разработчиков
Esri
Расскажите нам, что вы думаете.
Copyright © 2021 Esri. | Конфиденциальность | Правовая информация