Exemplo n.º 1
0
        public void Execute(IPCBIWindow parent)
        {
            wdlg = new PCB_Investigator.PCBIWindows.PCBIWorkingDialog();
            wdlg.SetAnimationStatus(false);
            wdlg.SetStatusPercent(0);
            wdlg.SetStatusText("Working");
            wdlg.CanCancel(true);

            IStep curStep = parent.GetCurrentStep();

            if (curStep == null)
            {
                return;
            }

            Dictionary <string, double> smallestDiameterList = new Dictionary <string, double>();
            StringBuilder sbResult = new StringBuilder();

            wdlg.ShowWorkingDlgAsThread();

            List <string> netNames  = curStep.GetAllNetNames();
            double        value     = 0;
            double        valueStep = ((100.0 / netNames.Count));


            foreach (string netName in curStep.GetAllNetNames())
            {
                INet net = curStep.GetNet(netName);

                wdlg.SetStatusText("Working on " + netName + "...");
                value += valueStep;
                wdlg.SetStatusPercent((int)(value));

                List <IODBObject> allNetElements = net.GetAllNetObjects(parent);
                if (allNetElements.Count == 0)
                {
                    continue;
                }

                double smallestDiameter = allNetElements[0].GetDiameter();
                foreach (IODBObject netElement in allNetElements)
                {
                    double currentDiameter = netElement.GetDiameter();
                    if (currentDiameter < 0)
                    {
                        continue;                      //e.g. surfaces have no diameter
                    }
                    if (currentDiameter < smallestDiameter)
                    {
                        smallestDiameter = currentDiameter;
                    }
                }

                smallestDiameterList.Add(netName, smallestDiameter);
                sbResult.AppendLine(netName + ": " + smallestDiameter.ToString() + " mils");
            }
            wdlg.Dispose();
            PCB_Investigator.Localization.PCBILocalization.ShowMsgBox("All smallest Net Diameters:" + Environment.NewLine + sbResult.ToString(), "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void nodFile(IPCBIWindow parent, string fileName, IStep step, IMatrix matrix, ref List <string> errorLogFile)
        {
            List <string>     lstStrNetNames = step.GetAllNetNames();
            List <ICMPObject> lstAllCMPList  = step.GetAllCMPObjects();

            List <IODBObject> lstListOfAllDrillObjects = creatingDrillList(matrix, step);

            if (lstListOfAllDrillObjects == null)
            {
                errorLogFile.Add("Method: nodFile + lstListOfAllDrillObjects is null");
                return;
            }
            List <ThtPin> topTHTPinList, botTHTPinList = new List <ThtPin>();
            List <INet>   lstINetINetList = new List <INet>();
            List <string> dataList;


            fileName = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".nod");

            foreach (string netName in lstStrNetNames)
            {
                lstINetINetList.Add(step.GetNet(netName));
            }


            checkPinLaysOverHole(step, lstListOfAllDrillObjects, out topTHTPinList, out botTHTPinList, matrix);

            fillNODDataList(parent, step, matrix, lstAllCMPList, topTHTPinList, botTHTPinList, out dataList, lstINetINetList, lstListOfAllDrillObjects, ref errorLogFile);

            if (dataList != null && !string.IsNullOrEmpty(fileName))
            {
                writeToFile(fileName, dataList);
            }
        }