jbwalker86

Need help with simple translation (VBA -> Pyhton)

Discussion created by jbwalker86 on Jul 16, 2012
Latest reply on Jul 17, 2012 by jbwalker86
Hello,

I need help from someone to translate a small piece of code from VBA to Phython, due to the fact that the company I am working for has upgraded from ArcGIS 9.3.1 to 10.0 and VBA is no longer supported.  The code block is as follows:



static x0 as double, y0 as double
dim pPoint as IPoint
set pPoint = [Shape]

x = pPoint.X
y = pPoint.Y
d = sqr((x-x0)^2 + (y-y0)^2)
x0 = x
y0= y


This is used with the calculate field tool inside model builder and as far as I can tell retrieves info about two points and calculates the difference in distance between them. I have attempted a few translations on my own with little success using !shape.firstpoint.x!, !shape.firstpoint.y!

Unfortunately my knowledge is lacking and I need some assistance.  If you are able to help, that would be greatly appreciated!

Thanks,

Jordan

Outcomes