Author Topic: Get Parent and Interfaces  (Read 3353 times)

jordi-koro

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Get Parent and Interfaces
« on: November 17, 2010, 11:07:51 pm »
Hi,

By vbscript, I'm trying to get the parents and interfaces of an element that is in a diagram.

I'm setting the parents and interfaces by going to the menu advanced/parents in the context menu, clicking on an element of a diagram.

I'm trying to get the relations introduced by EA.Element.Connectors and by EA.Element.GetRelationSet by i'm not getting any element.

Can you help me?
Thanks in advance

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13071
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get Parent and Interfaces
« Reply #1 on: November 18, 2010, 12:40:22 am »
Can you post your code?
That might be easier for us to spot the problem.

Geert

jordi-koro

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Get Parent and Interfaces
« Reply #2 on: November 18, 2010, 02:09:54 am »
Sorry,

Is not some code that is not working. The problem is that I don't how to get some data on EA.

1- I create a diagram
2- I add a class called X in a diagram.
3- I add to the class X by "right click"->Advanced -> parent (Type Hierarchy dialog), a new generalizes relation with the type Y

Then I need to get this relation by vbscript and I try to get it by several ways:

Getting first the element X I try:

1- to find the relation in the collection returned by X.Connectors
2- to find the relation in the collection returned by X.GetRelationSet(EA.EnumRelationSetType.rsGeneralizeEnd)
3- to find the relation in the collection returned by X.GetRelationSet(EA.EnumRelationSetType.rsGeneralizeStart)

At this 3 collections contains all other relations that I have with the class X but not the relation that I genarate by the Type Hierarchy dialog.

My question is:

Which is the way to get the element relations generated by the Type Hierarchy dialog.

jordi-koro

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Get Parent and Interfaces
« Reply #3 on: November 18, 2010, 10:13:54 pm »
Solved,

the method to get this relations is:

X.Genlinks

Thank you very much for your attention

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13071
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get Parent and Interfaces
« Reply #4 on: November 18, 2010, 11:34:44 pm »
That's bizar, do you mean that the Generalization and Realization connectors are not in Element.Connectors?
Do you see them in the Links tab of the properties dialog?

Smells like a bug to me...

Or is it because the parent class doesn't actually exist? (I noticed that you can  type anything when the "Accept Classifier even if not in model" is ticked)

Geert