Select to view content in your preferred language

click on a polygon and drop a number in the designated field in sequence

765
2
10-21-2018 02:27 AM
rao_muhammadimranulhaq
New Contributor

'm looking for a tool out there for sequential auto-numbering... something that uses the edit tool (or something similar) to simply click on a polygon and drop a number in the designated field in sequence, and it would obviously have to be easy to reset as the edit session progresses.

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

sounds pretty specialized and maybe an arcobjects task.

you could have a look at 

ArcGIS Code Sharing 

but I suspect you will have to implement your own

0 Kudos
rao_muhammadimranulhaq
New Contributor

import os
import re
import zipfile

current_path = os.path.dirname(os.path.abspath(__file__))

out_zip_name = os.path.join(current_path,
os.path.basename(current_path) + ".esriaddin")

BACKUP_FILE_PATTERN = re.compile(".*_addin_[0-9]+[.]py$", re.IGNORECASE)

def looks_like_a_backup(filename):
return bool(BACKUP_FILE_PATTERN.match(filename))

with zipfile.ZipFile(out_zip_name, 'w', zipfile.ZIP_DEFLATED) as zip_file:
for filename in ('config.xml', 'README.txt', 'makeaddin.py'):
zip_file.write(os.path.join(current_path, filename), filename)
dirs_to_add = ['Images', 'Install']
for directory in dirs_to_add:
for (path, dirs, files) in os.walk(os.path.join(current_path,
directory)):
archive_path = os.path.relpath(path, current_path)
found_file = False
for file in (f for f in files if not looks_like_a_backup(f)):
archive_file = os.path.join(archive_path, file)
print archive_file
zip_file.write(os.path.join(path, file), archive_file)
found_file = True
if not found_file:
zip_file.writestr(os.path.join(archive_path,
'placeholder.txt'),
"(Empty directory)")

0 Kudos