private static Dictionary <int, DeviceSymbol> GetDeviceSymbolById(E3Project project, E3Text text, Dictionary <int, DeviceConnection> deviceConnectionById)
        {
            NormalDevice device = project.GetNormalDeviceById(0);
            DevicePin    pin    = project.GetDevicePinById(0);
            Dictionary <int, DeviceSymbol> deviceSymbolById = new Dictionary <int, DeviceSymbol>();

            foreach (int connectionId in deviceConnectionById.Keys)
            {
                DeviceConnection deviceConnection = deviceConnectionById[connectionId];
                int startId = deviceConnection.StartDeviceId;
                int endId   = deviceConnection.EndDeviceId;
                if (!deviceSymbolById.ContainsKey(startId))
                {
                    device.Id = startId;
                    deviceSymbolById.Add(startId, new DeviceSymbol(device, pin));
                }
                if (!deviceSymbolById.ContainsKey(endId))
                {
                    device.Id = endId;
                    deviceSymbolById.Add(endId, new DeviceSymbol(device, pin));
                }
                deviceSymbolById[startId].ConnectionIds.Add(connectionId);
                deviceSymbolById[endId].ConnectionIds.Add(connectionId);
            }
            foreach (DeviceSymbol deviceSymbol in deviceSymbolById.Values)
            {
                deviceSymbol.SetCableIds(deviceConnectionById);
                deviceSymbol.SetPinsAndHeightAndNameWidth(deviceConnectionById, deviceSymbolById, text);
            }
            return(deviceSymbolById);
        }
        private static void GetDeviceConnectionByIdAndCableInfoById(E3Project project, HashSet <int> electricSchemeSheetIds, out Dictionary <int, DeviceConnection> deviceConnectionById, out Dictionary <int, CableInfo> cableInfoById)
        {
            CableDevice  cable       = project.GetCableDeviceById(0);
            CableCore    core        = project.GetCableCoreById(0);
            NormalDevice startDevice = project.GetNormalDeviceById(0);
            NormalDevice endDevice   = project.GetNormalDeviceById(0);
            DevicePin    startPin    = project.GetDevicePinById(0);
            DevicePin    endPin      = project.GetDevicePinById(0);
            WireCore     wire        = project.GetWireCoreById(0);

            deviceConnectionById = new Dictionary <int, DeviceConnection>();
            cableInfoById        = new Dictionary <int, CableInfo>();
            int connectionId = 0;

            foreach (int cableId in project.CableIds)
            {
                cable.Id = cableId;
                foreach (int coreId in cable.CoreIds)
                {
                    core.Id = coreId;
                    int startPinId = core.StartPinId;
                    int endPinId   = core.EndPinId;
                    if (endPinId == 0 || startPinId == 0)   // проверка на неподключенные концы
                    {
                        continue;
                    }
                    startPin.Id = startPinId;                               // id вывода
                    if (!electricSchemeSheetIds.Contains(startPin.SheetId)) // проверка на то, что вывод расположен на принципиальной схеме
                    {
                        continue;
                    }
                    endPin.Id = endPinId;
                    if (!electricSchemeSheetIds.Contains(endPin.SheetId))
                    {
                        continue;
                    }
                    startDevice.Id = startPinId;
                    endDevice.Id   = endPinId;
                    if (startDevice.Assignment.Equals(endDevice.Assignment) && !(startDevice.GetAttributeValue("IncludeInOWS").Equals("1") || endDevice.GetAttributeValue("IncludeInOWS").Equals("1")))
                    {
                        continue;
                    }
                    string signal = startPin.SignalName;
                    deviceConnectionById.Add(connectionId++, new DeviceConnection(startDevice.Id, startPin.Name, endDevice.Id, endPin.Name, cableId, signal));
                    string lengthAttribute = "Lenght_m_sp";
                    if (!cableInfoById.ContainsKey(cableId))
                    {
                        cableInfoById.Add(cableId, new CableInfo(cable, lengthAttribute));
                    }
                    cableInfoById[cableId].Signals.Add(signal);
                }
            }
            foreach (int wireId in project.WireIds)
            {
                wire.Id = wireId;
                int startPinId = wire.StartPinId;
                int endPinId   = wire.EndPinId;
                if (endPinId == 0 || startPinId == 0)   // проверка на неподключенные концы
                {
                    continue;
                }
                startPin.Id = startPinId;                               // id вывода
                if (!electricSchemeSheetIds.Contains(startPin.SheetId)) // проверка на то, что вывод расположен на принципиальной схеме
                {
                    continue;
                }
                endPin.Id = endPinId;
                if (!electricSchemeSheetIds.Contains(endPin.SheetId))
                {
                    continue;
                }
                startDevice.Id = startPinId;
                endDevice.Id   = endPinId;
                if (startDevice.Assignment.Equals(endDevice.Assignment) && !(startDevice.GetAttributeValue("IncludeInOWS").Equals("1") || endDevice.GetAttributeValue("IncludeInOWS").Equals("1")))
                {
                    continue;
                }
                string signal = startPin.SignalName;
                deviceConnectionById.Add(connectionId++, new DeviceConnection(startDevice.Id, startPin.Name, endDevice.Id, endPin.Name, wireId, signal));
                string lengthAttribute = "Lenght_m_sp";
                if (!cableInfoById.ContainsKey(wireId))
                {
                    cableInfoById.Add(wireId, new CableInfo(wire, lengthAttribute));
                }
                cableInfoById[wireId].Signals.Add(signal);
            }
        }