Construct a MultiPatch by extruding a (non-point) geometry between two specified Z values.
[Visual Basic .NET] Public Sub ConstructExtrudeFromTo ( _ ByVal fromZ As Double, _ ByVal toZ As Double, _ ByVal baseGeom As IGeometry _ )
[C#] public void ConstructExtrudeFromTo ( double fromZ, double toZ, IGeometry baseGeom );
[C++]
HRESULT ConstructExtrudeFromTo(
double fromZ,
double toZ,
IGeometry* baseGeom
);
[C++]Parameters
fromZ fromZ is a parameter of type double toZ toZ is a parameter of type double baseGeombaseGeom is a parameter of type IGeometry
Product Availability
Description
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along the Z-axis from a given FromZ input to a given ToZ input. The base Z value of the geometry is uniformly set to the FromZ and top Z value is set to a uniform ToZ. The resulting extrusion is always parallel to the XY-plane on both the base and top.
Remarks
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries.
private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
const double FromZ = 0;
const double ToZ = 8.5;
//Extrusion: 2D Polygon Composed Of Multiple Square Shaped Exterior Rings And Corresponding Interior Rings,
// Extruded To Generate Multiple 3D Buildings With Hollow Interiors Via ConstructExtrudeFromTo()
IPolygon polygon = new PolygonClass();
IGeometryCollection geometryCollection = polygon as IGeometryCollection;
//Exterior Ring 1
IPointCollection exteriorRing1PointCollection = new RingClass();
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(1, 1), ref _missing, ref _missing);
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(1, 4), ref _missing, ref _missing);
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(4, 4), ref _missing, ref _missing);
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(4, 1), ref _missing, ref _missing);
IRing exteriorRing1 = exteriorRing1PointCollection as IRing;
exteriorRing1.Close();
geometryCollection.AddGeometry(exteriorRing1 as IGeometry, ref _missing, ref _missing);
//Interior Ring 1
IPointCollection interiorRing1PointCollection = new RingClass();
interiorRing1PointCollection.AddPoint(ConstructPoint2D(1.5, 1.5), ref _missing, ref _missing);
interiorRing1PointCollection.AddPoint(ConstructPoint2D(1.5, 3.5), ref _missing, ref _missing);
interiorRing1PointCollection.AddPoint(ConstructPoint2D(3.5, 3.5), ref _missing, ref _missing);
interiorRing1PointCollection.AddPoint(ConstructPoint2D(3.5, 1.5), ref _missing, ref _missing);
IRing interiorRing1 = interiorRing1PointCollection as IRing;
interiorRing1.Close();
geometryCollection.AddGeometry(interiorRing1 as IGeometry, ref _missing, ref _missing);
//Exterior Ring 2
IPointCollection exteriorRing2PointCollection = new RingClass();
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(1, -1), ref _missing, ref _missing);
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(4, -1), ref _missing, ref _missing);
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(4, -4), ref _missing, ref _missing);
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(1, -4), ref _missing, ref _missing);
IRing exteriorRing2 = exteriorRing2PointCollection as IRing;
exteriorRing2.Close();
geometryCollection.AddGeometry(exteriorRing2 as IGeometry, ref _missing, ref _missing);
//Interior Ring 2
IPointCollection interiorRing2PointCollection = new RingClass();
interiorRing2PointCollection.AddPoint(ConstructPoint2D(1.5, -1.5), ref _missing, ref _missing);
interiorRing2PointCollection.AddPoint(ConstructPoint2D(3.5, -1.5), ref _missing, ref _missing);
interiorRing2PointCollection.AddPoint(ConstructPoint2D(3.5, -3.5), ref _missing, ref _missing);
interiorRing2PointCollection.AddPoint(ConstructPoint2D(1.5, -3.5), ref _missing, ref _missing);
IRing interiorRing2 = interiorRing2PointCollection as IRing;
interiorRing2.Close();
geometryCollection.AddGeometry(interiorRing2 as IGeometry, ref _missing, ref _missing);
//Exterior Ring 3
IPointCollection exteriorRing3PointCollection = new RingClass();
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-1, 1), ref _missing, ref _missing);
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-4, 1), ref _missing, ref _missing);
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-4, 4), ref _missing, ref _missing);
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-1, 4), ref _missing, ref _missing);
IRing exteriorRing3 = exteriorRing3PointCollection as IRing;
exteriorRing3.Close();
geometryCollection.AddGeometry(exteriorRing3 as IGeometry, ref _missing, ref _missing);
//Interior Ring 3
IPointCollection interiorRing3PointCollection = new RingClass();
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-1.5, 1.5), ref _missing, ref _missing);
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-3.5, 1.5), ref _missing, ref _missing);
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-3.5, 3.5), ref _missing, ref _missing);
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-1.5, 3.5), ref _missing, ref _missing);
IRing interiorRing3 = interiorRing3PointCollection as IRing;
interiorRing3.Close();
geometryCollection.AddGeometry(interiorRing3 as IGeometry, ref _missing, ref _missing);
//Exterior Ring 4
IPointCollection exteriorRing4PointCollection = new RingClass();
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-1, -1), ref _missing, ref _missing);
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-1, -4), ref _missing, ref _missing);
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-4, -4), ref _missing, ref _missing);
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-4, -1), ref _missing, ref _missing);
IRing exteriorRing4 = exteriorRing4PointCollection as IRing;
exteriorRing4.Close();
geometryCollection.AddGeometry(exteriorRing4 as IGeometry, ref _missing, ref _missing);
//Interior Ring 5
IPointCollection interiorRing4PointCollection = new RingClass();
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-1.5, -1.5), ref _missing, ref _missing);
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-1.5, -3.5), ref _missing, ref _missing);
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-3.5, -3.5), ref _missing, ref _missing);
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-3.5, -1.5), ref _missing, ref _missing);
IRing interiorRing4 = interiorRing4PointCollection as IRing;
interiorRing4.Close();
geometryCollection.AddGeometry(interiorRing4 as IGeometry, ref _missing, ref _missing);
IGeometry polygonGeometry = polygon as IGeometry;
ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeFromTo(FromZ, ToZ, polygonGeometry);
return constructMultiPatch as IGeometry;
}
public static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
See Also
IConstructMultiPatch Interface | IExtrude.ExtrudeBetween Method | IExtrude.ExtrudeAbsolute Method | IConstructMultiPatch.ConstructExtrudeAlongLine Method | IConstructMultiPatch.ConstructExtrudeRelative Method | IConstructMultiPatch.ConstructExtrude Method | IExtrude.ExtrudeFromTo Method | IExtrude.ExtrudeRelative Method | IConstructMultiPatch.ConstructExtrudeFromTo Method | IConstructMultiPatch.ConstructExtrudeAbsolute Method | IExtrude.Extrude Method | IConstructMultiPatch Interface | IExtrude Interface | IConstructMultiPatch.ConstructExtrudeBetween Method | IExtrude.ExtrudeAlongLine Method | IGlobeHeightProperties.ExtrusionExpressionString Property