Author Topic: Set CustomProperty (in AI)  for Connector Fails  (Read 4027 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8598
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Set CustomProperty (in AI)  for Connector Fails
« on: June 26, 2009, 04:22:11 pm »
public void SetConnectorCustomProperty(EA.Connector connector, string propertyName, string propertyValue)
{
    EA.CustomProperty oCustomProperty;
    for (short iCustomerPropertyIterator = 0; iCustomerPropertyIterator < connector.CustomProperties.Count; iCustomerPropertyIterator++)
    {
        oCustomProperty = (EA.CustomProperty)connector.CustomProperties.GetAt(iCustomerPropertyIterator);
        if (oCustomProperty.Name == propertyName)
        {
            oCustomProperty.Value = propertyValue;
        }
    }
}

Fails when attempting to set the diagram with a (to me) spurious error:
"EA_MenuClick: Element no longer available"

Anyone know how to set Custom Properties for Connectors?

Reported.
TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8598
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Set CustomProperty (in AI)  for Connector Fail
« Reply #1 on: July 07, 2009, 11:19:03 am »
Update:  Sparx have been able to reproduce and will investigate further.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Motlib

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Set CustomProperty (in AI)  for Connector Fails
« Reply #2 on: September 14, 2016, 06:52:17 pm »
Hello,

I know the topic is rather old, but did you (or anyone else) find a solution?

Background: I now ran into a very similar problem. When automating EA 10 (build 10.0.1009) I query the CustomProperties collection of a SysML port to get its isConjugated value. I can find the right CustomProperty in the collection (so accessing its .Name is no problem), but when I access its .Value, I get a COM Exception 80020009 Element no longer available.

When trying to reproduce the problem with a very basic EAP file with one SysML block and one port, the problem seems to disappears. But still appears with the model I need to automate.

Thanks and regards,

Motlib

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Set CustomProperty (in AI)  for Connector Fails
« Reply #3 on: September 14, 2016, 07:48:57 pm »
Few things to try:

- Run a project integrity check
- Upgrade to the latest version

If the steps above fail to resolve the issue then report a bug

Geert