Book a Demo

Author Topic: New element position in a diagram  (Read 4403 times)

Ricardo Guerra

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
New element position in a diagram
« on: March 06, 2009, 02:12:16 am »
Hi there,

i am automating the process of creating system tests from existing software requirements. I managed to do pretty much what i needed like adding elements to diagrams, linking to other objects and so on.

My issue here is with the position of new elements in a diagram.
How can i set the position of a new element in a diagram ?
I see the EA.Element object does not have a style like property to work with.

Thanks in advance!

Cheers,
Ricardo

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: New element position in a diagram
« Reply #1 on: March 06, 2009, 04:18:50 am »
To show an element in a diagram, call AddNew() on the diagram's DiagramObjects collection. This returns a DiagramObject which has properties like Left and Top.

Ricardo Guerra

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: New element position in a diagram
« Reply #2 on: March 06, 2009, 09:51:02 am »
Hey Frank,

this was really my bad...
thanks for guiding me to a solution.

Cheers,
Ricardo

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: New element position in a diagram
« Reply #3 on: March 07, 2009, 12:28:27 am »
Hi Ricardo,

At the risk of stating the obvious, remember to call Update on the DiagramObject. Even thought these are not 'real' entities in the model tree, they are part of the EA schema; they need a call to Update to save them into the model.

You should - perhaps you must - set the ClassifierID of the DiagramObject before you call update.

Note that there is an old property - the EA help notes that it is depreciated - that originates with a typo that got into the API. The old property used to serve the save value. Don't use it by accident. I do not think it will show up in Visual Studio for example, but you could still use it by accident or with another development tool. There is no guarantee it will work in future.

HTH, David
No, you can't have it!