Save custom element problem ArcObject Add-in.

682
2
04-19-2018 12:14 AM
tanerkoka
Occasional Contributor II

Hi , 

I develope command with ArcObject SDK Add-in for 10.5 ArcMap.I created my own polygon element  (MyElement) inherit PolygonElementClass , IElement, IPersistStream for Index Maping jobs in ArcMap for customers .But I have problem when I save and open document after adding my Element (MyElement)  in GraphicsContainer.

Here is below  my class and adding to IGraphicsContainer codes. With below code I can Add my own element on the GraphicsContainer  but but after save this document ArcMap crashes and gives exception like below.

When I Add simple ArcObject Polygon element (IElement element = new PolygonElementClass()) there is not any problem when opening and save document.

How can I sove this problem ? Can you help to me ?İs It Add-in support save objects using like IPersistStream ? Here is the codes and pictures below:

Codes :

public class MyElement : PolygonElementClass , IElement, IPersistStream

{

  public IEnvelope Env

  public string Name 

.....

.....properties,functions.etc.

}

ICompositeGraphicsLayer cGLayer =  ArcMap.Document.FocusMap.BasicGraphicsLayer as ICompositeGraphicsLayer;
IGraphicsLayer gLayer = cGLayer.AddLayer("Scale_1:1000", null);

...seting scale graphicLayer (ex: 1:1000)

IGraphicsContainer gCont = gLayer as IGraphicsContainer;

foreach (MyElement myEl in myElArray)
{

gCont.AddElement(myEl,0);

}

Creating my Element:

Creating own Element

Exception after save and open document in Arcmap:

Exception

Thanks.

Best Regards.

0 Kudos
2 Replies
tanerkoka
Occasional Contributor II
Do you have any information on this problem? Could this error be an Add-in bug?
0 Kudos
tanerkoka
Occasional Contributor II

Why can not you answer this question positively or negatively?

0 Kudos