ArcGIS Pro 2.6 API Reference Guide
Expand(Envelope,Double,Double,Double,Boolean) Method
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface > Expand Method : Expand(Envelope,Double,Double,Double,Boolean) Method
The envelope to expand or shrink.
The scale factor along the x-axis. In other words, the amount to expand or shrink the width of the envelope.
The scale factor along the y-axis. In other words, the amount to expand or shrink the height of the envelope.
The scale factor along the z-axis. In other words, the amount to expand or shrink the depth of the envelope.
If asRatio = false, the expansion is additive. If asRatio = true, the expansion is multiplicative.
Expands or shrinks the envelope in a 3-dimensional manner.
Syntax
Overloads Function Expand( _
   ByVal envelope As Envelope, _
   ByVal dx As Double, _
   ByVal dy As Double, _
   ByVal dz As Double, _
   ByVal asRatio As Boolean _
) As Envelope

Parameters

envelope
The envelope to expand or shrink.
dx
The scale factor along the x-axis. In other words, the amount to expand or shrink the width of the envelope.
dy
The scale factor along the y-axis. In other words, the amount to expand or shrink the height of the envelope.
dz
The scale factor along the z-axis. In other words, the amount to expand or shrink the depth of the envelope.
asRatio
If asRatio = false, the expansion is additive. If asRatio = true, the expansion is multiplicative.

Return Value

The scaled envelope.
Exceptions
ExceptionDescription
Envelope is null or empty.
This geometry is not Z-Aware.
Spatial reference of envelopeis an image coordinate system.
Remarks
The envelope must be z-aware or else an exception will be thrown.

If asRatio is set to true, dx, dy and dz must be greater than or equal to zero. In this case, if the user wants to increase the envelope width by 10%, then dx = 1.1. On the other hand, if the user wants to decrease the width by 10%, then dx = 0.9.

Example
Envelope env = EnvelopeBuilder.CreateEnvelope(100.0, 100.0, 500.0, 500.0);
// env.HasZ = false

Envelope result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, true);
// result.Center = 300, 300
// result.XMin = 200
// result.YMin = 200
// result.XMax = 400
// result.YMax = 400

result = GeometryEngine.Instance.Expand(env, 100, 200, false);
// result.Center = 300, 300
// result.XMin = 0
// result.YMin = -100
// result.XMax = 600
// result.YMax = 700

try
{
  // expand in 3 dimensions
  result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, 0.5, true);
}
catch (InvalidOperationException e)
{
  // the geometry is not Z-Aware
}

// expand a 3d envelope
MapPoint pt1 = MapPointBuilder.CreateMapPoint(100, 100, 100);
MapPoint pt2 = MapPointBuilder.CreateMapPoint(200, 200, 200);

env = EnvelopeBuilder.CreateEnvelope(pt1, pt2);
// env.HasZ = true
      
result = GeometryEngine.Instance.Expand(env, 0.5, 0.5, 0.5, true);

// result.Center = 150, 150, 150
// result.XMin = 125
// result.YMin = 125
// result.ZMin = 125
// result.XMax = 175
// result.YMax = 175
// result.ZMax = 175
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members
Overload List