ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / SetConstantZ Method
The polygon or polyline to replace Zs.
The Z value to assign.
Example

In This Topic
    SetConstantZ Method (GeometryEngine)
    In This Topic
    Replaces each Z value on the geometry with the specified Z-value.
    Syntax
    Public Function SetConstantZ( _
       ByVal multipart As Multipart, _
       ByVal zValue As Double _
    ) As Multipart
    public Multipart SetConstantZ( 
       Multipart multipart,
       double zValue
    )

    Parameters

    multipart
    The polygon or polyline to replace Zs.
    zValue
    The Z value to assign.

    Return Value

    A geometry in which each coordinate has the specified Z-value. If the input multipart is empty, then it is returned unchanged.
    Exceptions
    ExceptionDescription
    Multipart is null.
    This geometry is not Z-Aware.
    Example
    Set all Zs in a polyline
    {
      List<Coordinate3D> coordsZ =
      [
        new Coordinate3D(1, 2, 3),
      new Coordinate3D(4, 5, 6),
      new Coordinate3D(7, 8, double.NaN)
      ];
    
      polyline = PolylineBuilderEx.CreatePolyline(coordsZ);
      // polyline.HasZ = true
    
      Polyline polylineSetZ = GeometryEngine.Instance.SetConstantZ(polyline, -1) as Polyline;
      // polylineSetZ.Points[0].Z = -1
      // polylineSetZ.Points[1].Z = -1
      // polylineSetZ.Points[2].Z = -1
    
      polylineSetZ = GeometryEngine.Instance.SetConstantZ(polyline, double.NaN) as Polyline;
      // polyline.HasZ = true
      // polylineSetZ.Points[0].HasZ = true
      // polylineSetZ.Points[0].Z = NaN
      // polylineSetZ.Points[1].HasZ = true
      // polylineSetZ.Points[1].Z = NaN
      // polylineSetZ.Points[2].HasZ = true
      // polylineSetZ.Points[2].Z = NaN
    
      polylineSetZ = GeometryEngine.Instance.SetConstantZ(polyline, double.PositiveInfinity) as Polyline;
      // polyline.HasZ = true
      // polylineSetZ.Points[0].HasZ = true
      // polylineSetZ.Points[0].Z = double.PositiveInfinity
      // polylineSetZ.Points[1].HasZ = true
      // polylineSetZ.Points[1].Z = double.PositiveInfinity
      // polylineSetZ.Points[2].HasZ = true
      // polylineSetZ.Points[2].Z = double.PositiveInfinity
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also