Book a Demo

Author Topic: add an existing class to an existing diagram  (Read 3242 times)

brighton

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
add an existing class to an existing diagram
« on: February 07, 2007, 08:18:13 am »
Hi all,

I want to use an addin to add existing classes and objects in a package to an existing diagram in the same package. Sounds straightforward but..i am only a newbe. The .addNew method seems to work fine for creating new stuff and adding it to a Collection but what about stuff that already exists. Maybe its the order of .updates and .refreshs that just doesn't make the stuff appear on the diagram.
I have got some code that adds an an existing class(Element?) to an collection of DiagramObjects of a Diagram. It runs with no exceptions, just no class on diagram.
Cheers

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: add an existing class to an existing diagram
« Reply #1 on: February 07, 2007, 08:57:00 am »
What you really need to do is add a new DiagramObject to the diagram, using the AddNew method of the diagram's DiagramObjects collection.

Then you need to set the new DiagramObject's ElementID to point to the element you want to appear on the diagram.

Remember to call Update() on the new DiagramObject at this point, and you should be fine.

David
No, you can't have it!