This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IC > IConstructMultiPatch Interface > IConstructMultiPatch.ConstructExtrudeAlongLine Method (ArcObjects .NET 10.5 SDK) |
Construct a MultiPatch by extruding a (non-point) geometry along a specified line, using the Zs on the two ends of the line to set Zs on the top and bottom.
[Visual Basic .NET] Public Sub ConstructExtrudeAlongLine ( _ ByVal extrusionLine As ILine, _ ByVal baseGeom As IGeometry _ )
[C#] public void ConstructExtrudeAlongLine ( ILine extrusionLine, IGeometry baseGeom );
[C++]
HRESULT ConstructExtrudeAlongLine(
ILine* extrusionLine,
IGeometry* baseGeom
);
[C++]
Parameters extrusionLine
extrusionLine is a parameter of type ILine baseGeom
baseGeom is a parameter of type IGeometry
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along an axis defined by the input Line. The base Z value of the geometry is uniformly set to the Z value of the Along Line's FromPoint and top Z value is uniformly set to the Z value of the Along Line's ToPoint. The top geometry is also shifted in the X and Y directions by an offset defined by the X and Y change of the Along Line between From and To Points. The resulting extrusion is always parallel to the XY-plane on both the base and top.
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 GetExample10()
{
const double CircleDegrees=360.0;
const int CircleDivisions=36;
const double VectorComponentOffset=0.0000001;
const double CircleRadius=3.0;
const double BaseZ=0.0;
//Extrusion: 3D Circle Polygon Extruded Along 3D Line Via ConstructExtrudeAlongLine()
IPointCollection polygonPointCollection = new PolygonClass();
IGeometry polygonGeometry=polygonPointCollection as IGeometry;
MakeZAware(polygonGeometry);
IPoint originPoint=ConstructPoint3D(0, 0, 0);
IVector3D upperAxisVector3D=ConstructVector3D(0, 0, 10);
IVector3D lowerAxisVector3D=ConstructVector3D(0, 0, -10);
lowerAxisVector3D.XComponent += VectorComponentOffset;
IVector3D normalVector3D=upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;
normalVector3D.Magnitude=CircleRadius;
double rotationAngleInRadians=GetRadians(CircleDegrees / CircleDivisions);
for (int i=0; i < CircleDivisions; i++)
{
normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);
IPoint vertexPoint=ConstructPoint3D(originPoint.X + normalVector3D.XComponent,
originPoint.Y + normalVector3D.YComponent,
BaseZ);
polygonPointCollection.AddPoint(vertexPoint, ref _missing, ref _missing);
}
polygonPointCollection.AddPoint(polygonPointCollection.get_Point(0), ref _missing, ref _missing);
ITopologicalOperator topologicalOperator=polygonGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
//Define Line To Extrude Along
ILine extrusionLine = new LineClass();
extrusionLine.FromPoint=ConstructPoint3D(-4, -4, -5);
extrusionLine.ToPoint=ConstructPoint3D(4, 4, 5);
//Perform Extrusion
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeAlongLine(extrusionLine, polygonGeometry);
//Transform Extrusion Result
IArea area=polygonGeometry as IArea;
ITransform2D transform2D=constructMultiPatch as ITransform2D;
transform2D.Move(extrusionLine.FromPoint.X - area.Centroid.X, extrusionLine.FromPoint.Y - area.Centroid.Y);
return constructMultiPatch as IGeometry;
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}
private static double GetRadians(double decimalDegrees)
{
return decimalDegrees * (Math.PI / 180);
}
private static IPoint ConstructPoint3D(double x, double y, double z)
{
IPoint point=ConstructPoint2D(x, y);
point.Z=z;
return point;
}
private static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
private static void MakeZAware(IGeometry geometry)
{
IZAware zAware=geometry as IZAware;
zAware.ZAware = true;
}
IConstructMultiPatch Interface | IExtrude.ExtrudeBetween Method | IConstructMultiPatch.ConstructExtrudeAbsolute Method | IConstructMultiPatch.ConstructExtrudeBetween Method | IExtrude.ExtrudeAbsolute Method | IConstructMultiPatch.ConstructExtrudeRelative Method | IConstructMultiPatch.ConstructExtrudeFromTo Method | IConstructMultiPatch Interface | IConstructMultiPatch.ConstructExtrudeAlongLine Method | IConstructMultiPatch.ConstructExtrude Method | IExtrude.Extrude Method | IExtrude.ExtrudeFromTo Method | IExtrude.ExtrudeRelative Method | IExtrude.ExtrudeAlongLine Method | IExtrude Interface | IGlobeHeightProperties.ExtrusionExpressionString Property