0

I created an addin for EA and trying to run a query to know for a specific part on which parts is allocated. For example (see picture attached) I want to know for part A on what parts is allocated, should appear B and C.

Also I need methods in C# for addin:

  1. to delete allocation a
  2. to add allocation for a specific part. Example: I want to allocate part T to Part B from C# code

Property A << allocate >> to property B

enter image description here

I'm searching in t_object for type Abstraction, maybe this is not the good EA table

Ice
  • 193
  • 1
  • 2
  • 13

1 Answers1

2

You should look into the EA.Element.Connectors collection.

You can use that collection to loop the existing connectors and check their Stereotype property for the value "allocate"

Use the EA.Element.Connectors.AddNew("name", "type") method to add a new connector. Select an existing connector in the GUI and look into the stereotypes field for the correct fully qualified stereotype name to be used as the type parameter. (something like ProfileName::StereotypeName)

Use the EA.Element.Connectors.Delete(index) method to delete connectors.

More details in the documentation for Element, Connector and Collection

If you are trying to use Repository.SQLQuery() to search for the allocated element, you should look into the t_connector table.

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
  • I never use the DeleteAt but rather Delete since I have never seen any effect of the 2nd parameter (it might have been fixed in the many years since my first encounter, though unlikely, but alas having two operations doing the same thing is Sparxian as usual). – qwerty_so May 31 '22 at 08:02
  • Ah, since you added the link: _The second parameter is currently unused._ OMG – qwerty_so May 31 '22 at 08:03
  • 1
    I've been using DeleteAt(), but don't ask me why. I probably started once, and then kept doing the same thing everywhere. I think I've noticed the refresh parameter work at one instance, but I can't be sure. It sure is confusing that here is a parameter that tricks you into thinking it will do a refresh. I'll update the answer to spare others the confusion. – Geert Bellekens May 31 '22 at 08:07
  • 1
    When walking in Sparxian area you'll always have mud on your shoes ;-) – qwerty_so May 31 '22 at 08:17