ArcGIS Pro 2.8 API Reference Guide
CalculateNonSimpleZs Method (IGeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface : CalculateNonSimpleZs Method
The polygon or polyline to calculate Z-values for.
The value to which NaN Z-values that could not be interpolated will be set.
Calculates Z attribute values for each non-simple (NaN) Z-value from existing simple (non-NaN) Z attributes on the specified geometry. The non-simple Z values are obtained by extrapolation/interpolation for polylines and interpolation for polygons.
Syntax
Multipart CalculateNonSimpleZs( 
   Multipart multipart,
   double defaultZValue
)
Function CalculateNonSimpleZs( _
   ByVal multipart As Multipart, _
   ByVal defaultZValue As Double _
) As Multipart

Parameters

multipart
The polygon or polyline to calculate Z-values for.
defaultZValue
The value to which NaN Z-values that could not be interpolated will be set.

Return Value

A geometry in which each coordinate has a simple (non-NaN) Z value.
Exceptions
ExceptionDescription
Multipart is null or empty.
This geometry is not Z-Aware.
Example
List<Coordinate3D> coords2 = new List<Coordinate3D>()
{
  new Coordinate3D(0, 0, 0),
  new Coordinate3D(0, 1000, double.NaN),
  new Coordinate3D(1000, 1000, 50),
  new Coordinate3D(1000, 1000, 76),
  new Coordinate3D(0, 1000, double.NaN),
  new Coordinate3D(0, 0, 0)
};

SpatialReference sr = SpatialReferences.WebMercator;

Polyline polyline = PolylineBuilder.CreatePolyline(coords2, sr);

// polyline.HasZ = true
// polyline.Points[1].HasZ = true
// polyline.Points[1].Z  = NaN   
// polyline.Points[4].HasZ = true
// polyline.Points[4].Z  = NaN   

Polyline polylineNoNaNZs = GeometryEngine.Instance.CalculateNonSimpleZs(polyline, 0) as Polyline;

// polylineNoNaNZs.Points[1].HasZ = true
// polylineNoNaNZs.Points[1].Z = 25  (halfway between 0 and 50)
// polylineNoNaNZs.Points[4].HasZ = true
// polylineNoNaNZs.Points[4].Z = 38  (halfway between 76 and 0)
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members