AnsweredAssumed Answered

How to delete the vertex in arcmap using vb.net?

Question asked by mahakarthik on Feb 19, 2016

Dear all,

         I am using arcmap 9.3 and vb.net i need to delete the vertex pragmatically. i have the feature and index of delete vertex but i dont know how to delete the vertex any one give me the sample code for delete vertex. i am using following code its not working.

 

  Function deletevertex(ByVal index As Integer, ByVal pointCollection As IPointCollection)

        Dim editorUID As UID

        editorUID = New UID

        editorUID.Value = "esriEditor.Editor"

        Dim editor As IEditor

        editor = (papp.FindExtensionByCLSID(editorUID))

 

        Dim editSketch As IEditSketch

        If editor Is Nothing Then

            Exit Function

        End If

 

        editSketch = CType(editor, IEditSketch)

        If index = -1 Then

        End If

        Dim sketchOperation As ISketchOperation

        sketchOperation = New SketchOperation

        sketchOperation.MenuString_2 = "Delete Vertex"

        sketchOperation.Start(editor)

        pointCollection = editSketch.Geometry

        pointCollection.RemovePoints(index, 1)

        editSketch.RefreshSketch()

        sketchOperation.Finish(editSketch.Geometry.Envelope)

    

    End Function

 

above code show the error of

"the index either too small or too large".

 

Note:

If i am select the Feature using "modifying Feature" that time vertex deleted successfully. if i am select the vertex using "new feature creation " that time only the index either too large or too small error showing.

Outcomes