4

How do you get an annotation layer working inside a group layer? When I try, I get the error message "error adding element".

I have a project that requires several annotation layer to be organised within a Group Layer.

Tested in ArcMap 9.3.1 and 10.

Steps to reproduce:

  1. Create a new document
  2. Add a Annotation Featureclass to ArcMap
  3. Start Editing
  4. On the Draw Toolbar, change the Active Annotation Target to the Annotation Featureclass
  5. Draw something (e.g. freehand) - This should work!
  6. Create a New Group Layer
  7. Move the Annotation Featureclass inside it.
  8. The Annotation Target has now been lost!
  9. On the Draw Toolbar, change the Active Annotation Target to the Annotation Featureclass
  10. Draw something (e.g. freehand) - This does not work!
  11. You will get the error message "error adding element"

You will now not be able to write to this Featureclass unless you save the document, close ArcMap and re-open it. This is not an acceptable workaround for my project. Is there a workaround, preferably in ArcObjects?

This might relate to an ArcMap 8.3 bug submitted in 2001.

1
  • 1
    In the event there are no useful answers here, try filing the bug with tech support and on ideas.argis.com (and link to it from here so interested parties can follow up). Commented Feb 10, 2012 at 7:48

1 Answer 1

3

I was able to reproduce your problem.

This might be a workaround: after step 9, if I run the VBA Hack() shown below then set the active target again I'm able to add anno without the message. I'm on a machine with 9.3.1 and no visual studio, but this should also work in .NET.

Sub Hack()
    Dim pOCopy As IObjectCopy
    Set pOCopy = New ObjectCopy

    Dim pMxDoc As IMxDocument
    Set pMxDoc = ThisDocument

    Dim pNewMap As IMap
    Set pNewMap = pOCopy.Copy(pMxDoc.FocusMap)

    pOCopy.Overwrite pNewMap, pMxDoc.FocusMap
End Sub

Not the answer you're looking for? Browse other questions tagged or ask your own question.