import arcpy, sys, string, os, fpformat mxd = arcpy.mapping.MapDocument("CURRENT") layers = arcpy.mapping.ListLayers(mxd) for layer in layers: if layer.name == "3dLine": layerexists = 1 fields = ["SHAPE@Z","FromLevel","ToLevel"] if layerexists == 1: strLineFC = "3dLine" lineRows = arcpy.da.UpdateCursor(strLineFC, fields) lineRow = lineRows.next() while lineRow: linePointsArray = lineRow.Shape.getPart(0) pt_count = linePointsArray.count pt_begin = linePointsArray.next() # First Vertex on line row[0] = row[1] vertices = 2 while vertices < pt_count: pt_end = linePointsArray.next() vertices = vertices + 1 pt_end = linePointsArray.next() # Last Vertex on line row[0] = row[2]
Solved! Go to Solution.
Interpolating Z values should be done with caution.Thanks for your caution. The datasets I am working with are sewer pipes, so they don't have a direct relation to the actual terrain (other than being below the terrain elevation). Interpolation in this situation should work for most of the lines where required I think 🙂
If the data comes as shapefiles there are no true curves. True curves would only be created and preserved in a geodatabase. But it is a potential gotcha if you ever do work with geodatabase true curves.Most of our third party data comes from AutoCAD DWG file, which I think does also allow for curves. We shouldn't have many/any though.
Thanks for your caution. The datasets I am working with are sewer pipes, so they don't have a direct relation to the actual terrain (other than being below the terrain elevation). Interpolation in this situation should work for most of the lines where required I think 🙂
Cheers,
Mike.