!Shape.Centroid.X!See the field calculator help here for more on geometry calculation in ArcGIS 10. Also the Python syntax was incorrect in the post above. The exclamations points go around the Shape qualifiers as shown above. So !Shape.FirstPoint.X! might also work, but it would not return the same result as your original VBA calculation, since that is returning the Centroid.
Additional Information: The following knowledge base article describes the procedure HowTo: Convert an annotation feature class to a shapefile But the following error is displayed. Executing (Calculate Field (2)): CalculateField "\\hcgis1\gis\Arc\Projects\WTH\Work_Area\Work Data.gdb\Work_Anno" Longitude Output VB "Dim Output As Double Dim pArea As IArea Set pArea = [Shape] Output = pArea.Centroid.X" Start Time: Wed Dec 28 09:08:27 2011 General error executing calculator. ERROR 999999: Error executing function. Expected end of statement Failed to execute (Calculate Field (2)). Failed at Wed Dec 28 09:08:30 2011 (Elapsed Time: 3.00 seconds) The same error displays when attempting the calculation; (1) directly on the field (i.e. Field Calculator) in an edit session, and (2) With the "Calculate Field" tool in my model - FYI the model "used" to work at 9.3.1. Thanks in advance.
Executing (Calculate Field (2)): CalculateField "\\hcgis1\gis\Arc\Projects\WTH\Work_Area\Work Data.gdb\Work_Anno" Longitude Output VB "Dim Output As Double Dim pArea As IArea Set pArea = [Shape] Output = pArea.Centroid.X" Start Time: Wed Dec 28 09:08:27 2011 General error executing calculator. ERROR 999999: Error executing function. Expected end of statement Failed to execute (Calculate Field (2)). Failed at Wed Dec 28 09:08:30 2011 (Elapsed Time: 3.00 seconds)
We will return a reference to the Point who has its own properties which are defined within the Point Class help topic. If you look in that help topic you will see the following properties, ID, X, Y, Z, M. So finally if we write the expression:!Shape!.firstPoint.Z
Dim Output As Double Dim pArea As IArea Set pArea = [Shape] Output = pArea.Centroid.X
!SHAPE!.firstPoint.Z
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.