Book a Demo

Author Topic: How to Find link b/w block & its instances?  (Read 6105 times)

hshahid

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
How to Find link b/w block & its instances?
« on: November 08, 2010, 11:52:23 pm »
Hi,

I am using EA. 8.0, its API and C#. I have created a SysML block "Car" in a diagram and then created its instance in the same diagram "BlackCar:Car".

Now what happens is when I create a new instance of a block, EA creates a new property in in the repository and name it "BlackCar", but using API, I am not able to get relation b/w the block and its instances. i.e. I am able to get "BlackCar" as a property in my XML but I am not sure which attribute of API "Element" will contain the information about showing any relationship b/w the instance "BlackCar" and its type which should be "Car".

Can any one guide me, how I can reterive this information using API. I have tried different properties, e.g, Element.MetaType, Element.Type etc etc... but was not able to guess the property which will actually tell information required.

Thanks & Regards,
Hamid

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to Find link b/w block & its instances?
« Reply #1 on: November 08, 2010, 11:57:12 pm »
Hamid,

Have you tried Element.ClassifierID ?

Geert

hshahid

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: How to Find link b/w block & its instances?
« Reply #2 on: November 09, 2010, 12:32:10 am »
Yes Greet,

I have tried all these properties like ClassfierID, ClassifierID, ClassifierName, ClassifierType but they are not providing the information needed.  :(


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to Find link b/w block & its instances?
« Reply #3 on: November 09, 2010, 12:45:15 am »
Hamid,

What is in ClassifierID then?

Geert

hshahid

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: How to Find link b/w block & its instances?
« Reply #4 on: November 09, 2010, 12:51:24 am »
Greet its "0" in everycase.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to Find link b/w block & its instances?
« Reply #5 on: November 09, 2010, 12:55:24 am »
Then I have no idea. I guessed the Sysml instance would be like a UML object, but apparently that is not the case.

Geert

hshahid

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: How to Find link b/w block & its instances?
« Reply #6 on: November 09, 2010, 01:28:45 am »
Thanks Greet.

Any suggestions anyone...?

hshahid

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: How to Find link b/w block & its instances?
« Reply #7 on: November 10, 2010, 12:15:26 am »
Guys any ideas...

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: How to Find link b/w block & its instances
« Reply #8 on: November 10, 2010, 08:27:44 am »
If Geert is unable to help, your best bet would be to put in a support request.
« Last Edit: November 10, 2010, 08:28:01 am by skiwi »
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to Find link b/w block & its instances?
« Reply #9 on: November 10, 2010, 08:42:24 am »
I think you'll the guid of the type in MiscData(0) (or PDATA1).

hshahid

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: How to Find link b/w block & its instances?
« Reply #10 on: November 10, 2010, 11:44:08 pm »
Hi Skiwi - Thanks.


Hi Simon,

I guess it is not the ID because, I tried myElement.get_MiscData(0), but it returns a strange kind of value ="{057293CA-F6F7-45b3-832D-F264AA990DCE}".

Please let me know, if Element ID of the type can be extracted from this value? We can see the Type of the sysml block object in E.A, so there must be a way by which E.A maintains the association when its running.

Please let me know, your views about it.

Thanks.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to Find link b/w block & its instances
« Reply #11 on: November 11, 2010, 08:22:17 am »
It's the guid.

Try Repository.GetElementByGUID.
« Last Edit: November 11, 2010, 08:22:30 am by simonm »

hshahid

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: How to Find link b/w block & its instances?
« Reply #12 on: November 13, 2010, 01:01:43 am »
Thanks Simon, it worked :)


Following Code is to help someone who is facing same problem;

classElement = (EA.Element)m_Repository.GetElementByGuid(tempElement.get_MiscData(0));

if (classElement != null)
{
      className = classElement.Name;
      cassID = classElement.ElementID;
}