Book a Demo

Author Topic: adding a new Diagram automatically  (Read 2918 times)

stao

  • EA User
  • **
  • Posts: 137
  • Karma: +0/-0
    • View Profile
adding a new Diagram automatically
« on: May 13, 2010, 05:16:35 am »
Hi everyone,

I searched the Forum but didnt find an answer to my problem

Code: [Select]
EA.Element sdmContainer = (EA.Element)(methparent.Elements.AddNew(meth.Name + " SDM Container", "Class"));
sdmContainer.Stereotype = "SDM_Container";
sdmContainer.Update();
EA.Diagram fledgedDiag = (EA.Diagram(sdmContainer.Diagrams.AddNew(meth.Name + " Story Diagram", "SDM_Diagram::SDM_Diagram"));
fledgedDiag.Update();

the call of fledgDiag.Update();
always crashes EA
when i restart and reload my Project in EA the Diagram was perfectly added even it crashed before.

If i dont call the method EA doestn crash but the new Diagram is not visible in the project browser.

THX for your time

Stao
« Last Edit: May 13, 2010, 05:18:12 am by stao »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: adding a new Diagram automatically
« Reply #1 on: May 17, 2010, 03:58:20 pm »
Stao,

What I would do is try reloading the sdmContainer object from the database by getting it again from the methparent.Elements collection. (after calling a refresh on methparent.Elements)

It's just a hunch, but maybe something (like the guid was not properly loaded in the object after update())

Geert