-
Notifications
You must be signed in to change notification settings - Fork 0
/
editor_tools.pyt
50 lines (40 loc) · 1.9 KB
/
editor_tools.pyt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import arcpy
from un_editor_solutions import SelectRelated
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Utility Network Editor Tools"
self.alias = "utilsol_Editor_Tools"
# List of tool classes associated with this toolbox
self.tools = [SelectRelatedRecords]
class SelectRelatedRecords(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Select Related Records"
self.description = "Select Releated Records"
self.category = ""
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
relate_map = arcpy.Parameter(name='relate_map',
displayName='Layer Relationship Map',
datatype='GPValueTable',
direction='Input',
parameterType='Optional',
enabled=None,
category=None,
symbology=None,
multiValue=None)
relate_map.columns = [['GPFeatureLayer', 'Source Layer'], ['Field', 'Source Key Field'],
['GPFeatureLayer', 'Target Layer'], ['Field', 'Target Key Field']]
# "{C99D0042-EF42-4B04-8A0B-1A53F6DB67A6}" -- proportional (no + sign and no separator)
# "{1AA9A769-D3F3-4EB0-85CB-CC07C79313C8}" # + sign and separator
relate_map.controlCLSID = "{1AA9A769-D3F3-4EB0-85CB-CC07C79313C8}"
return [relate_map]
def execute(self, parameters, messages):
"""The source code of the tool."""
self.run()
@staticmethod
def run():
SelectRelated().main(None)