import arcpy infc = arcpy.GetParameterAsText(0) # input feature class (polyline) zfield = arcpy.GetParameterAsText(1) # field with elevation value outfile = arcpy.GetParameterAsText(2) # output file f = open(outfile, 'w') for row in arcpy.da.SearchCursor(infc, ['SHAPE@', zfield]): f.write('\n{elevation:12.3f}{vertices:12.0f}\n'.format( elevation=row[1], vertices=row[0].pointCount) ) for part in row[0]: pntcount = 1 for pnt in part: if pnt: if pntcount % 3 = 0: f.write('{0:12.1f}{1:12.1f}\n'.format(pnt.X,pnt.Y)) else: f.write('{0:12.1f}{1:12.1f}'.format(pnt.X,pnt.Y)) pntcount += 1 f.close()
5.000 8 247822.0 6896884.5 248152.7 6896829.0 248210.9 6896754.9 248210.9 6896662.3 248128.9 6896590.9 248004.5 6896455.9 248168.6 6896154.3 248375.0 6896135.8 10.000 8 248697.7 6897106.8 248576.0 6896802.5 248351.1 6896553.8 248361.7 6896455.9 248470.2 6896326.3 248602.5 6896278.6 248758.6 6896321.0 248946.5 6896437.4
5.000 8 247822.0 6896884.5 248152.7 6896829.0 248210.9 6896754.9 248210.9 6896662.3 248128.9 6896590.9 248004.5 6896455.9 248168.6 6896154.3 248375.0 6896135.8 10.000 8 248697.7 6897106.8 248576.0 6896802.5 248351.1 6896553.8 248361.7 6896455.9 248470.2 6896326.3 248602.5 6896278.6 248758.6 6896321.0 248946.5 6896437.4
Solved! Go to Solution.
if pntcount % 3 == 0: f.write('{0:12.1f}{1:12.1f}\n'.format(pnt.X,pnt.Y)) else: f.write('{0:12.1f}{1:12.1f}\n'.format(pnt.X,pnt.Y))
if pntcount % 3 == 0: f.write('{0:12.1f}{1:12.1f}\n'.format(pnt.X,pnt.Y)) else: f.write('{0:12.1f}{1:12.1f}\n'.format(pnt.X,pnt.Y))