Arcmap and Python
Arcmap and Python
Why Python?
2:23:00 PM
2:23:00 PM
2:23:00 PM
2:23:00 PM
2:23:00 PM
2:23:00 PM
2:23:00 PM
Requires MIDL.EXE
Obtain by downloading and installing
Windows SDK 7.1:
http://www.microsoft.com/download/en/details.aspx?id=8279
2:23:00 PM
2:23:00 PM
2:23:00 PM
2:23:00 PM
2:23:00 PM
2:23:01 PM
2:23:01 PM
2:23:01 PM
2:23:01 PM
2:23:01 PM
Add a toolbar:
Add a tool:
2:23:01 PM
2:23:01 PM
Double-click DemoAddin.esriaddin to
install add-in:
2:23:03 PM
2:23:03 PM
2:23:03 PM
class DemoExtension(object):
_wxApp = None
def __init__(self):
self.enabled = True
def startup(self):
try:
from wx import PySimpleApp
self._wxApp = PySimpleApp()
self._wxApp.MainLoop()
except:
sMsg = "Error starting extension:\n" + \
traceback.format_exc()
pythonaddins.MessageBox(sMsg, "DemoAddIn")
2:23:03 PM
class DemoTool(object):
_pApp = None
_geometry = None
_sQuote = None
_dlg = None
def __init__(self):
self.enabled = True
self.cursor = 3
Not stubbed out
self.shape = "Line" # Can set to . . .
by default:
def onClick(self):
if self._dlg is None:
from QuoteDialog import QuoteDialog
self._dlg = QuoteDialog(sMyPath, self)
self._dlg.Show(True)
def deactivate(self):
if self._dlg is None:
return
self._dlg.Show(False)
def onLine(self, line_geometry):
self._geometry = line_geometry
self.DoIt()
2:23:03 PM
10
20
30
40
50
60
70
80
90
100
C++
92
VBA
48
.NET
32
Python
24
IronPython
Java
16
Benchmark = 500+K ShapeCopy operations
2:22:58 PM
100
2:23:03 PM
Questions?
Mark Cederholm
mcederholm@uesaz.com
This presentation and sample code
may be downloaded at:
http://www.pierssen.com/arcgis10/python.htm
For 9.x examples, see:
http://www.pierssen.com/arcgis/misc.htm
2:23:03 PM