AnsweredAssumed Answered

Copy and Paste Features between Feature Classes - VB.NET ArcGIS 10

Question asked by crdale on Apr 17, 2012
Latest reply on May 9, 2012 by crdale
Hello all,

I'm currently in the midst of upgrading a custom tool from 9.3.1 executable to 10.0 ESRI add-in, and I've come across two commands, esriArcMapUI.EditCopyCommand and esriArcMapUI.EditPasteCommand that aren't working properly.  An edit session is started through code, features are selected through a query and placed in a feature selection, and then the two command names get passed into the following method:

-----------------------

Public Shared Sub ExecuteCmdArcMap(ByVal strUID As String)
            'Description:      Executes the spcified ArcMap Command Button.
            'Input Parameters: 1) strUID(String) representing the specified ArcMap tool's UID.
            Dim pDoc As ESRI.ArcGIS.Framework.IDocument
            Dim pCmdBars As ESRI.ArcGIS.Framework.ICommandBars
            Dim pItem As ESRI.ArcGIS.Framework.ICommandItem
            Dim pUID As UID

            Try
                pUID = New UID
                pUID.Value = strUID
                pDoc = My.ArcMap.Document
                pCmdBars = pDoc.CommandBars
                pItem = pCmdBars.Find(pUID)
                pItem.Execute()
            Catch ex As Exception
                StatusLog.LogError(ex.ToString)
            End Try
        End Sub

--------------------------

The copy command is copying selected road centerline features from one feature class stored in an SDE database, and pasting them into an identical copy of the same feature class stored in either a file geodatabase or a personal geodatabase (a new database gets created at the beginning of the tool, and it is up to the user to select which database he or she wants to use).  When the code tries to execute these commands, I get the following error message: "No acceptable target available.  Target geometry type must match that of the feature(s) being pasted."  This doesn't make sense to me because the geometry of two feature classes is the same since they are both line feature classes.

I have a couple of hunches: 1) the copy and paste functionality has changed between 9.3.1 and 10, which is something that I've dealt with before in other upgrades but not quite in this manner.  From experience, when you manually copy a feature in the ArcMap UI and paste it, a dialog box comes up and prompts you to select a target layer to paste to.  I also tested the copy/paste manually between the two feature classes and it worked.  2) There may be differences between a feature class in an SDE database and one in a personal or file geodatabase.

Does anyone have any ideas on how to either replace these commands or make them work?

Thanks!

-Channing


Edit: I've also been experimenting with the editing template functionality and seeing if these need to be accessed for copying and pasting.

Outcomes