4

I'm relatively new to the world of model builder and scripting, so it's likely there is a very simple solution to the question I've been trying to figure out.

I'm trying to create a tool that takes a given shapefile, interpolates it over a given surface, adds a "Length_3D" field, then calculates that length (3D) in the attribute table using the Calculate Field tool in the Data Management Toolbox. I've done the same for 2D length using !shape.length@miles! as the expression and I have no issues there.

What I can't seem to figure out is how to write an expression that will allow me to calculate the 3D length from my already interpolated line. Right now the model runs all the way through until this point then throws an error. I'm able to open the newly created ZM shape and calculate the 3D length by using the "Calculate Geometry" tool in the attribute table then selecting "3D Length". I'd really like to be able to perform this in the model though. Has anyone else had a similar issue or know how to write the expression? I've tried "!shape.3DLength@miles!, !shape.3D_Length@miles!, and !shape.3D Length@miles!" with no luck. Thanks!

2

Try the following combination:

!shape.length3d!

Hope that helps!

  • Thanks for the suggestion, but that doesn't seem to be working either. I get the following error after running the model: ERROR 000539: Invalid property length3d. Valid properties: labelpoint, type, extent, truecentroid, firstpoint, lastpoint, ismultipart, hullrectangle, area, length, partcount, pointcount, centroid – Lew Sovocool Nov 6 '13 at 21:42
2

!shape.length3D! does work.

I had to make sure that I selected the PYTHON_9.3 Expression type in the Calculate field Options dialog. (I'm running 10.2.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.