SetProgressor

AllSource 1.4    |

Краткая информация

Создает объект прогрессора для поддержки информации о прогрессоре, которая отображается на панели Геообработка. Вешний вид прогрессора может определяться выбором прогрессора по умолчанию или пошагового прогрессора.

Синтаксис

SetProgressor (type, {message}, {min_range}, {max_range}, {step_value})
ПараметрОписаниеТип данных
type

Specifies the progressor type.

  • defaultThe progressor moves continuously from side to side in a repeating pattern.
  • stepThe progressor shows the percentage complete.

(Значение по умолчанию — default)

String
message

The progressor label. The default is no label.

String
min_range

The minimum value for the progressor. The default is 0.

(Значение по умолчанию — 0)

Integer
max_range

The maximum value for the progressor. The default is 100.

(Значение по умолчанию — 100)

Integer
step_value

The progressor step interval for updating the progress bar.

(Значение по умолчанию — 1)

Integer

Пример кода

Пример работы SetProgressor

Задает объект прогрессора для отображения хода выполнения процесса на панели Геообработка.

import os
import arcpy

# Allow overwriting of output
arcpy.env.overwriteOutput = True

# Set current workspace
arcpy.env.workspace = "c:/data"

# Get a list of shapefiles in folder
fcs = arcpy.ListFeatureClasses()

# Find the total count of shapefiles in list
fc_count = len(fcs)

# Set the progressor
arcpy.SetProgressor("step", "Copying shapefiles to geodatabase...",
                    0, fc_count, 1)

# Create a file gdb to contain new feature classes
arcpy.management.CreateFileGDB(arcpy.env.workspace, "fgdb.gdb")

# For each shapefile, copy to a file geodatabase
for shp in fcs:
    # Trim the '.shp' extension
    fc = os.path.splitext(shp)[0]

    # Update the progressor label for current shapefile
    arcpy.SetProgressorLabel("Loading {0}...".format(shp))

    # Copy the data
    arcpy.management.CopyFeatures(shp, os.path.join("fgdb.gdb", fc))

    # Update the progressor position
    arcpy.SetProgressorPosition()

arcpy.ResetProgressor()

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