ArcObjects Library Reference (Geometry)

# IEnvelope.ExpandZ Method

Moves the Z attribute of the sides toward or away from each other.

```[Visual Basic .NET]
Public Sub ExpandZ ( _
ByVal dz As Double, _
ByVal asRatio As Boolean _
)```
```[C#]
public void ExpandZ (
double dz,
bool asRatio
);```
```[C++]
HRESULT ExpandZ(
double dz,
VARIANT_BOOL asRatio
);```
```[C++]
Parameters
dz
dz is a parameter of type double
asRatio
asRatio is a parameter of type VARIANT_BOOL
```

#### Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

#### Description

ExpandZ scales the Z attributes of the Envelope.  If asRatio = FALSE, the scaling is additive (ZMin = ZMin - dz, ZMax = ZMax + dz).  If asRatio = TRUE, the scaling is multiplicative (ZMin = ZMin - dz*Depth/2, ZMax = ZMax + dz*Depth/2)

[C#]

public static void TestExpandZ()

{

const double ScaleFactor = 1.986;

IEnvelope2 envelope = GetEnvelopeGeometry() as IEnvelope2;

double beforeXMin, beforeXMax, beforeYMin, beforeYMax;

envelope.QueryCoords(out beforeXMin, out beforeYMin, out beforeXMax, out beforeYMax);

double beforeZMin, beforeZMax;

envelope.QueryZCoords(out beforeZMin, out beforeZMax);

envelope.ExpandZ(ScaleFactor, true);

double afterXMin, afterXMax, afterYMin, afterYMax;

envelope.QueryCoords(out afterXMin, out afterYMin, out afterXMax, out afterYMax);

double afterZMin, afterZMax;

envelope.QueryZCoords(out afterZMin, out afterZMax);

//beforeXMin = -8.604

//beforeXMax = 1.396

//beforeYMin = -12.117

//beforeYMax = -2.117

//beforeZMin = -12.902

//beforeZMax = -2.902

//afterXMin = -8.604

//afterXMax = 1.396

//afterYMin = -12.117

//afterYMax = -2.117

//afterZMin = -17.829

//afterZMax = 2.026

}