Пример #1
0
        public static EAAPI.Connector AddConnector(this EAAPI.Element source, EAAPI.Element target, string connetcorType)
        {
            EAAPI.Connector connector = (EAAPI.Connector)source.Connectors.AddNew("", connetcorType);
            connector.SupplierID = target.ElementID;
            connector.Update();

            source.Connectors.Refresh();

            return(connector);
        }
        public static string GetTaggedValueString(this EAAPI.Connector connector, string tagName)
        {
            string result = "";

            for (int i = 0; i < connector.TaggedValues.Count; i++)
            {
                EAAPI.ConnectorTag tag = (EAAPI.ConnectorTag)connector.TaggedValues.GetAt((short)i);
                if (tag.Name == tagName)
                {
                    result = tag.Value;
                    break;
                }
            }

            return(result);
        }
Пример #3
0
        public static void DeleteConnector(this EAAPI.Repository repository, EAAPI.Connector con)
        {
            EAAPI.Element element = repository.GetElementByID(con.ClientID);

            short index = -1;

            for (short i = 0; i < element.Connectors.Count; i++)
            {
                EAAPI.Connector c = element.Connectors.GetAt(i) as EAAPI.Connector;
                if (c.ConnectorID == con.ConnectorID)
                {
                    index = i;
                    break;
                }
            }

            if (index != -1)
            {
                element.Connectors.Delete(index);
                element.Connectors.Refresh();
            }
        }