Book a Demo

Author Topic: How to create a instance of an  element using AI  (Read 2873 times)

patson

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
How to create a instance of an  element using AI
« on: June 10, 2010, 07:35:53 am »
Hi,
I developpe Add-Ins for Enterprise Architect in C# and I have the following problem.
I want to add the instance of an existing element in a new created diagram.
I have already created the diagram and I can add an element to the diagram using the collectionDiagramObjects and setting the diagramObjects with the elementID of the existing element.
But to add an instance I have to create it and I don´t know how to do that.

I thought that the ClassifierID of an element "element2" is the elementID of an element "element1"  if element2 is an instance of element1.
But when I add an element2 in the package and set it ClassifierID attribut with the elementID of element1 and then apply update on element2, element2 does not have the symbol of an instance and does not behave as a instance.

I will be very thankful if somebody can help me.

Patson

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to create a instance of an  element using
« Reply #1 on: June 10, 2010, 08:31:56 am »
What types are your classifier and instance?

The most common instance type is to create is "Object", although it could also be "Lifeline".

Setting a classifier of a Class element is meaningless and will have no effect.

patson

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: How to create a instance of an  element using
« Reply #2 on: June 11, 2010, 01:05:06 am »
Hi Simon,
I have already found it. At first time I used a "Class"-Type therefore it could not work. I have change it to a "Object"-Type and it is work properly now.
Thank for your reply.
Patson