Book a Demo

Author Topic: currentModel.connectors not working  (Read 3911 times)

danielhsh

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
currentModel.connectors not working
« on: August 23, 2010, 05:47:59 am »
Code: [Select]
       private Hashtable produceLinkTable(EA.Package currentPackage)
        {
            Hashtable tempHash = new Hashtable();
            for (int k = 0; k < currentPackage.Connectors.Count; k++)
            {
                EA.Connector tempConnector = ((EA.Connector)currentPackage.Connectors.GetAt((short)k));
                tempHash.Add(tempConnector.ConnectorID, tempConnector);
            }
            return tempHash;
        }

and when I do a connectors.count.... zero! I am pretty sure I got tons of connectors in the diagrams, I had been calling them from diagramLinks, which all gave me valid connectorIds. Please help, cheers!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: currentModel.connectors not working
« Reply #1 on: August 23, 2010, 08:19:06 am »
The connectors collection on a package would correspond to the connectors to that package, not the connectors to elements within the package.

danielhsh

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: currentModel.connectors not working
« Reply #2 on: August 23, 2010, 02:44:13 pm »
so if I want to retrieve the connectors from a package that is on a particular diagram, what should I do?

I tried calling diagrams.diagramlinks to get the connectors ids, and tried using package.connectors to call all the connectors to match with those connector ids. Howeever, I am stuck at the point where package.connectors give me no connectors.

Thanks!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: currentModel.connectors not working
« Reply #3 on: August 23, 2010, 03:32:44 pm »
Daniel,

If you have a connectorID use Repository.GetConnectorByID (long ConnectorID) to get the connector object.

Geert

danielhsh

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: currentModel.connectors not working
« Reply #4 on: August 23, 2010, 08:33:37 pm »
Solved! thanks for your help.