Book a Demo

Author Topic: How to get a package having a connector  (Read 2993 times)

jaro-lew

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
How to get a package having a connector
« on: May 30, 2018, 04:59:02 pm »
I'm trying to find out how to get in code (C#) a Package object connected on the diagram with one element with a connector, for example of type Abstraction.

I've found out that the connector from this object connects to
package.Element.ElementID (not with package.packageID)

And here I cannot get from package.Element (this is not from package.Elements collection) to "containing" package.

ParentId is equal 0, and PackageId gives the ID of parent package of the package I need.


Can you advice me?


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to get a package having a connector
« Reply #1 on: May 30, 2018, 05:28:49 pm »
Use Package.Element. That holds the Connectors collection.

q.

jaro-lew

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: How to get a package having a connector
« Reply #2 on: May 30, 2018, 05:35:56 pm »
I have found a way:

package = repository.getPackageByGuid(packageElementTheConnectorPointsTo.ElementGUID);

Both package and package.Element have the same GUIDs

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to get a package having a connector
« Reply #3 on: May 30, 2018, 05:37:49 pm »
That works, but takes an internal assumption (which holds true for all EA versions, though). However, use Package.Element which is explicitly documented that way.

q.