How to add point IDs to a polyline

Adding point IDs to a polyline

The following code example makes an existing polyline point ID aware and defines ID values for each of its vertices:
static void AddPointIDs(IFeatureClass featureClass)throws Exception{
    IFeatureCursor featureCursor =, true);
    IFeature currentFeature = featureCursor.nextFeature();

    while (currentFeature != null){
        IPointIDAware pointIDAware = (IPointIDAware)currentFeature.getShape();

        //The polyline is now point ID aware. It will persist its point IDs the next 
        //time it is saved.
        ISegmentCollection segmentCollection = (ISegmentCollection)pointIDAware;
        IEnumSegment segmentEnumeration = segmentCollection.getEnumSegments();

        ISegment currentSegment[] = new ISegment[1];
        int partIndex[] = new int[1];
        int segmentIndex[] = new int[1];, partIndex, segmentIndex);

        while (currentSegment != null){
            ISegmentID segmentID = (ISegmentID)currentSegment[0];
            segmentID.setIDs(segmentIndex[0], segmentIndex[0] + 1);
  , partIndex, segmentIndex);


        currentFeature = featureCursor.nextFeature();

Development licensingDeployment licensing
ArcGIS for Desktop BasicArcGIS for Desktop Basic
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
Engine Developer KitEngine