Field Calculator - Python replacement for simple VB Script - Move XY

479
1
10-31-2011 06:37 AM
JimW1
by
Occasional Contributor II
Hello everyone,

We've been using the super simple syntax:
[Shape] = Shape
[Shape].X = [NEAR_X] 
[Shape].Y = [NEAR_Y]

To move the location of points in field calculator to new positions based on NEAR results. ThisVB Script doesn't work in Arc10 and now I have to learn python to replace 2 lines of code and I barely do any coding now.

It gives me the error Object Required 'esri__1' in both ArcCatalog and ArcMap. I read somewhere it has to do with the new VB Script parser. This model step is in the middle of a 50+ process model so any solution needs to work in line.

I've searched and searched for a simple python version with no success. My workaround is to just make a new feature with 'XY Event' but I'd really rather just update the 'broken by version 10' code.

Any help would be appreciated.
0 Kudos
1 Reply
JimW1
by
Occasional Contributor II
With the help of Google I found the answer to my own question on this website:

http://nodedangles.wordpress.com/2011/03/08/calculating-geometry-using-arcpy-in-field-calculator/

This works perfectly and is only one line of code so Python wins this round...

Solution:

arcpy.Point(!Near_X!,!Near_Y!)
0 Kudos