![]()  | 
                    
                         This document is archived and information here might be outdated. Recommended version.  | 
                
| ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IG > IGeometryBridge2 Interface > IGeometryBridge2.SplitDivideLength Method (ArcObjects .NET 10.4 SDK) | 
Divide segment into smaller segments of the specified length.
[Visual Basic .NET] Public Sub SplitDivideLength ( _ ByVal pSegment As ISegment, _ ByVal Offset As Double, _ ByVal Length As Double, _ ByVal asRatio As Boolean, _ ByRef numSplitSegments As Integer, _ ByRef splitSegments As ISegment[] _ )
[C#] public void SplitDivideLength ( ISegment pSegment, double Offset, double Length, bool asRatio, ref int numSplitSegments, ref ISegment[] splitSegments );
[C++]
HRESULT SplitDivideLength(
  ISegment* pSegment,
  double Offset,
  double Length,
  VARIANT_BOOL asRatio,
  long* numSplitSegments,
  Array* splitSegments
);
[C++]
Parameters pSegment [in]
pSegment is a parameter of type ISegment Offset [in] Offset is a parameter of type double Length [in] Length is a parameter of type double asRatio [in] asRatio is a parameter of type VARIANT_BOOL numSplitSegments [out] numSplitSegments is a parameter of type long splitSegments [in, out] splitSegments is a parameter of type Array
    public void SplitDivideLength()
    {
        //Construct Polycurve
        IPoint fromPoint=new PointClass();
        fromPoint.PutCoords(0, 0);
        IPoint toPoint=new PointClass();
        toPoint.PutCoords(100, 0);
        ILine line=new LineClass();
        line.FromPoint=fromPoint;
        line.ToPoint=toPoint;
        /* offset: start, 0  -> we start from the beginning
         * length: the desired output length for all segments execpt the last one
         * asRatio: ratio
        */
        double offset=0;
        double length=10;
        bool asRatio=false;
        int numberOfSplittedSegments;
        //NOTE that our array is of length 2 but we will get 10 Segments.
        //This means that only the first 2 Segements are copied to the array.
        //Nevertheless numberOfSplittedSegments will be=10
        ISegment[] splittedSegments=new ISegment[2];
        for (int i=0; i < 2; i++)
        {
            splittedSegments[i]=new PolylineClass() as ISegment;
        }
        ISegment segment=line as ISegment;
        IGeometryBridge2 geometryBridge=new GeometryEnvironmentClass();
        geometryBridge.SplitDivideLength(segment, offset, length, asRatio, out numberOfSplittedSegments, ref splittedSegments);
        //print segments length
        for (int i=0; i < splittedSegments.Length; i++)
        {
            System.Windows.Forms.MessageBox.Show(splittedSegments[i].Length.ToString());
        }
    }