Esempio n. 1
0
        public void Execute(IPCBIWindow parent)
        {
            //fill code here code
            IStep step  = parent.GetCurrentStep();
            bool  onOff = false;

            if (step == null)
            {
                return;
            }

            while (true)
            {
                Thread.Sleep(1000);
                foreach (IODBObject objSel in step.GetSelectedElements())
                {
                    if (onOff)
                    {
                        parent.IColorsetting.DrawOnlySelectedElements = true;
                        objSel.ObjectColorTemporary(Color.White);
                    }
                    else
                    {
                        objSel.ObjectColorTemporary(Color.Empty);
                    }
                }
                onOff = !onOff;

                parent.UpdateView();
                if (isDisposed)
                {
                    break;
                }
            }
        }
        public void Execute(IPCBIWindow parent)
        {
            string netName = "TestNet";

            PCB_Investigator.PCBIWindows.PCBIEnterTextDialog enterDLG = new PCB_Investigator.PCBIWindows.PCBIEnterTextDialog("Enter Net Name", "Net Name", netName, false, false);
            if (enterDLG.ShowDialog() == DialogResult.OK)
            {
                netName = enterDLG.GetText();
            }
            else
            {
                return;
            }

            IStep currentStep = parent.GetCurrentStep();

            foreach (IODBObject selectedObj in currentStep.GetSelectedElements())
            {
                ILayer parentLayer = currentStep.GetLayer(selectedObj.GetParentLayerName());
                if (parentLayer == null)
                {
                    continue;
                }

                if (parentLayer is IODBLayer)
                {
                    AddNetInfos(currentStep, (IODBLayer)parentLayer, netName, selectedObj);
                }
            }

            parent.UpdateView();
        }
Esempio n. 3
0
 public void Execute(IPCBIWindow parent)
 {
     Parent = parent;
     CreatePads();
     CreateDrills();
     CreateCopperLines();
 }
Esempio n. 4
0
        public void Execute(IPCBIWindow parent)
        {
            IStep   step   = parent.GetCurrentStep();
            IMatrix matrix = parent.GetMatrix();

            if (matrix == null || step == null)
            {
                return;                                 //if there is no data loaded -> return
            }
            IODBLayer topLayer = step.GetOutsideODBLayer(true);

            if (topLayer != null)
            {
                MarkAllSMDPadsOnLayer(topLayer, matrix.GetAllDrillLayersForThisLayer(topLayer.LayerName), step);
                topLayer.EnableLayer(true); //to see the result for top side immidiatly, it will be enabled
            }
            IODBLayer botLayer = step.GetOutsideODBLayer(false);

            if (botLayer != null)
            {
                MarkAllSMDPadsOnLayer(botLayer, matrix.GetAllDrillLayersForThisLayer(botLayer.LayerName), step);
            }

            parent.UpdateView(); //redraw to show marked smd pads
        }
        public void Execute(IPCBIWindow parentPCBI)
        {
            if (parentPCBI == null)
            {
                MessageBox.Show("No license!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return;
            }

            if (!parentPCBI.JobIsLoaded)
            {
                return;
            }
            IStep curStep = parentPCBI.GetCurrentStep();

            if (curStep == null)
            {
                return;                  //no step -> no job -> break;
            }
            IFilter filter = new IFilter(parentPCBI);

            foreach (ILayer layer in curStep.GetActiveLayerList())
            {
                IODBLayer  newLayer    = filter.CreateEmptyODBLayer("newLayerWithCutting_" + layer.GetLayerName(), curStep.Name, false);
                IPolyClass outlinePoly = curStep.GetPCBOutlinePoly();

                if ((!(layer is IODBLayer)) || !CutRectangle(outlinePoly, (IODBLayer)layer, newLayer, filter, parentPCBI))
                {
                    MessageBox.Show("Something is wrong, cutting has not worked!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            parentPCBI.UpdateView();
            IMatrix matrix = parentPCBI.GetMatrix();

            matrix.UpdateDataAndList();
        }
Esempio n. 6
0
        public void Execute(IPCBIWindow parent)
        {
            try{
                SaveFileDialog saveTgz = new SaveFileDialog();
                saveTgz.Filter = "Tgz-Archiv(*.7z)|*.7z";
                saveTgz.Title  = "Save 7z-Archiv";
                if (saveTgz.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                var processStartInfo = new System.Diagnostics.ProcessStartInfo();
                processStartInfo.FileName = @"D:\Program Files\7-Zip\7z.exe";

                if (!File.Exists(processStartInfo.FileName))
                {
                    MessageBox.Show("This script works only with installation of 7z on your D-Drive. Please change path in code or install 7z first.", "Warning");
                    return;
                }
                string directoryPath = parent.GetODBJobDirectory();
                string args          = "a -r " + saveTgz.FileName + " " + directoryPath;
                //example from there faq 7z.exe a -r c:\a.7z "C:\Data"

                processStartInfo.Arguments = args;

                var process = System.Diagnostics.Process.Start(processStartInfo);

                process.WaitForExit();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error! " + ex.ToString(), "Error");
            }
        }
        public void Execute(IPCBIWindow parent)
        {
            IFilter           filter         = new IFilter(parent);
            IODBObject        outlinePolygon = filter.CreateOutlinePolygon();
            IStep             parentStep     = parent.GetCurrentStep();
            ISurfaceSpecifics spec           = (ISurfaceSpecifics)outlinePolygon.GetSpecifics();

            spec.StartPolygon(false, new PointF());
            RectangleF newBounds = new RectangleF(0, 0, 15000, 10000);

            //create 4 lines and add them to an contour polygon
            PointF leftUp    = new PointF(newBounds.Left, newBounds.Top);
            PointF leftDown  = new PointF(newBounds.Left, newBounds.Bottom);
            PointF rightUp   = new PointF(newBounds.Right, newBounds.Top);
            PointF rightDown = new PointF(newBounds.Right, newBounds.Bottom);

            spec.AddLine(leftUp, rightUp);
            spec.AddLine(rightUp, rightDown);
            spec.AddLine(rightDown, leftDown);
            spec.AddLine(leftDown, leftUp);

            spec.EndPolygon(); //close the new contour

            parentStep.SetPCBOutline(spec);
            parent.UpdateView();
        }
Esempio n. 8
0
        public void Execute(IPCBIWindow parent)
        {
            IFilter filter = new IFilter(parent);

            //your code here
            foreach (ILayer layer in parent.GetCurrentStep().GetActiveLayerList())
            {
                List <IODBObject> objectsToMove = new List <IODBObject>();
                foreach (IODBObject obj in layer.GetAllLayerObjects())
                {
                    foreach (DictionaryEntry entry in obj.GetAttributes())
                    {
                        if (entry.Key.ToString() == "_string")
                        {
                            objectsToMove.Add((IODBObject)obj);
                        }
                    }
                }


                IODBLayer newLayer = filter.CreateEmptyODBLayer(layer.GetLayerName() + "_1", parent.GetCurrentStep().Name);
                filter.InsertElementsToLayer(0, newLayer, objectsToMove, new PointD(0, 0), false, false, 0);

                foreach (IODBObject mo in objectsToMove)
                {
                    ((IODBLayer)layer).RemoveObject(mo);
                }
            }

            parent.UpdateControlsAndResetView();
        }
Esempio n. 9
0
        private void SetToGrid(float grid, IPCBIWindow parent)
        {
            IStep step = parent.GetCurrentStep();

            foreach (IODBObject obj in step.GetSelectedElements())
            {
                IObjectSpecifics obs = obj.GetSpecifics();
                if (obs.GetType() == typeof(ILineSpecifics))
                {
                    ILineSpecifics lines = (ILineSpecifics)obs;
                    lines.Start.X = correction(lines.Start.X, grid);
                    lines.Start.Y = correction(lines.Start.Y, grid);

                    lines.End.X = correction(lines.End.X, grid);
                    lines.End.Y = correction(lines.End.Y, grid);
                    obj.SetSpecifics(lines);
                }
                else
                if (obs.GetType() == typeof(IPadSpecifics))
                {
                    IPadSpecifics pads = (IPadSpecifics)obs;

                    pads.Location.X = correction(pads.Location.X, grid);
                    pads.Location.Y = correction(pads.Location.Y, grid);
                    obj.SetSpecifics(pads);
                }
            }
        }
 public void Execute(IPCBIWindow parent)
 {
     //your code here
     Parent = parent;
     Report_Via_Pad();
     parent.UpdateView();
 }
Esempio n. 11
0
        public void Execute(IPCBIWindow parent)
        {
            //your code here
            SetToGrid(100f, parent); // 100 mils

            parent.UpdateView();
        }
Esempio n. 12
0
        private void PrepareFor3D_inNBI(IPCBIWindow Parent)
        {
            IMatrix matrix = Parent.GetMatrix();
            IStep   step   = Parent.GetCurrentStep();

            MakeSolderMaskPositive(matrix);
            MakeDrillCutOutOnCopperLayers(Parent, matrix, step);

            Parent.UIAction.Execute(ID_ActionItem.ID_CLEAR_SELECTION);
            Parent.UIAction.Execute(ID_ActionItem.ID_ALL_LAYER_OFF);
            Parent.UIAction.Execute(ID_ActionItem.ID_ALL_SIGNAL_LAYER_ON);
            Parent.UpdateView();

            Parent.UIAction.Execute(ID_ActionItem.ID_SAVE);

            String JobLocation = Parent.GetODBJobDirectory();

            if (File.Exists(pathNBICatia))
            {
                try
                {
                    ProcessStartInfo ps = new ProcessStartInfo(pathNBICatia, "\"" + JobLocation + "\"");
                    Process.Start(ps);
                    //  Process.Start(pathNBICatia + " " + "\"" +  JobLocation + "\"");
                }

                catch (Exception ex)
                {
                    PCB_Investigator.Localization.PCBILocalization.ShowMsgBox("Can not open NBI, because " + ex.Message.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
        }
        public void Execute(IPCBIWindow parent)
        {
            IMatrix m    = parent.GetMatrix();
            IStep   step = parent.GetCurrentStep();


            foreach (ICMPObject comp in step.GetAllCMPObjects())
            {
                IPackageSpecificsD pack     = comp.GetPackageSpecificsD();
                RectangleD         rectBody = pack.GetBodyBounds();
                RectangleD         rect     = pack.GetBounds();
                comp.AddComponentAttribute("Body_Width", rectBody.Width.ToString());
                comp.AddComponentAttribute("Body_Height", rectBody.Height.ToString());
                // rect = GetPinBounds(comp);
                comp.AddComponentAttribute("Pin_Width", rect.Width.ToString());
                comp.AddComponentAttribute("Pin_Height", rect.Height.ToString());
                comp.AddComponentAttribute("Pin_Area", (rect.Height * rect.Width).ToString());
                //   if(comp.GetPinList().Count == 2)
                // {
                //   string shouldBe = GetGeometrieName(rect.Height * rect.Width);
                //  comp.AddComponentAttribute("Geometry_Calculated", shouldBe );
                // }
            }

            parent.UpdateView();
        }
Esempio n. 14
0
        public void Execute(IPCBIWindow mainWindowPCBI)
        {
            IStep step = mainWindowPCBI.GetCurrentStep();

            if (step == null)
            {
                return;
            }

            ICMPLayer layerCMPsTop = step.GetCMPLayer(true);

            //exisits the compnenent layer?
            if (layerCMPsTop == null)
            {
                return;
            }

            foreach (string layername in step.GetAllLayerNames())
            {
                List <ILayer> layers = new List <ILayer>();
                layers.Add(step.GetLayer(layername));
                SaveImageFromComponent(step, layers, FileLocation);
            }
            //something went wrong?
            string errorLog = IAutomation.GetErrorLog();

            if (errorLog.Length > 0)
            {
                System.Diagnostics.Debug.WriteLine(errorLog);
            }
        }
        public void Execute(IPCBIWindow PCBI_Host)
        {
            LoadInformation Information;

            // Gerber
            PCBI_Host.LoadData(@"D:\D_\jobs\_Jobs\A2z34\gerberfile.ger", out Information);
        }
 public void Execute(IPCBIWindow parent)
 {
     //your code here
     this.parent = parent;
     AddGroup();
     parent.UpdateView();
 }
        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);
            }
        }
        public void Execute(IPCBIWindow parent)
        {
            IStep   step   = parent.GetCurrentStep();
            IMatrix matrix = parent.GetMatrix();

            if (matrix == null || step == null)
            {
                return;                                 //if there is no data loaded -> return
            }
            ILayer topMaskLayer  = step.GetLayer(matrix.FindSideLayerLayerName(MatrixLayerType.Solder_mask, true));
            ILayer topPasteLayer = step.GetLayer(matrix.FindSideLayerLayerName(MatrixLayerType.Solder_paste, true));

            if (topMaskLayer != null && topPasteLayer != null)
            {
                MarkMaskOverPadsOnPaste((IODBLayer)topMaskLayer, (IODBLayer)topPasteLayer, step);
            }

            ILayer botMaskLayer  = step.GetLayer(matrix.FindSideLayerLayerName(MatrixLayerType.Solder_mask, false));
            ILayer botPasteLayer = step.GetLayer(matrix.FindSideLayerLayerName(MatrixLayerType.Solder_paste, false));

            if (botMaskLayer != null && botPasteLayer != null)
            {
                MarkMaskOverPadsOnPaste((IODBLayer)botMaskLayer, (IODBLayer)botPasteLayer, step);
            }


            parent.UpdateView(); //redraw to show marked smd pads
        }
Esempio n. 19
0
        public void Execute(IPCBIWindow parent)
        {
            IStep step = parent.GetCurrentStep();

            if (step == null)
            {
                return;
            }

            //the symbol diameter selected by user
            float diameterReplacedSymbolsInMils = 1;

            foreach (ILayer activeLayer in step.GetActiveLayerList())
            {
                if (!(activeLayer is IODBLayer)) //component and picture layer irrelevant
                {
                    continue;
                }

                IODBLayer Layer       = (IODBLayer)activeLayer;
                int       symbolIndex = -1;
                IFilter.AddToolDefinitionRound(Layer, diameterReplacedSymbolsInMils);
                foreach (IODBObject obj in Layer.GetAllLayerObjects())
                {
                    if (obj.GetDiameter() == 0) //all elements with diameter 0 replaced by new symbol
                    {
                        if (symbolIndex < 0)
                        {
                            symbolIndex = IFilter.AddToolDefinitionRound(Layer, diameterReplacedSymbolsInMils); //add new symbol only if used
                        }
                        obj.SetSpecifics(obj.GetSpecificsD(), symbolIndex);
                    }
                }
            }
        }
Esempio n. 20
0
        private static void MakeDrillCutOutOnCopperLayers(IPCBIWindow Parent, IMatrix matrix, IStep step)
        {
            IFilter filter            = new IFilter(Parent);
            int     counterDielectirc = 1;

            foreach (string layerName in matrix.GetAllDrillLayerNames())
            {
                ILayer drill_layer = step.GetLayer(layerName);

                bool lastWasSignal = false;
                foreach (string sigLayer in matrix.GetAllLayerWithThisDrills(layerName))
                {
                    var type = matrix.GetMatrixLayerType(sigLayer);
                    if (type != MatrixLayerType.Dielectric && !matrix.IsSignalLayer(sigLayer)) //only dielectric und signals
                    {
                        continue;
                    }
                    if ((type == MatrixLayerType.Power_ground || type == MatrixLayerType.Signal))
                    {
                        if (lastWasSignal)
                        {
                            //if last and current one are signals -> we need a dielectric between both
                            IODBLayer dielectric = filter.CreateEmptyODBLayer("dielectric_" + counterDielectirc, step.Name);
                            counterDielectirc++;
                            if (dielectric != null)
                            {
                                AddDrillObjects(filter, drill_layer, MatrixLayerType.Dielectric, dielectric);
                                matrix.SetMatrixLayerIndex(dielectric.GetLayerName(), matrix.GetRawIndexByName(sigLayer));
                                matrix.SetMatrixLayerParameter(dielectric.GetLayerName(), MatrixLayerContext.Board, MatrixLayerPolarity.Negative, MatrixLayerType.Dielectric, -1, -1);
                                matrix.SetLayerHeight(dielectric.GetLayerName(), 5); //value in mils
                                matrix.UpdateDataAndList();                          //update list for correct order
                            }
                            else
                            {
                                Debug.WriteLine("error, can't create dielectric...");
                            }
                        }

                        lastWasSignal = true;
                    }
                    else
                    {
                        lastWasSignal = false;
                    }

                    IODBLayer odb_sig_layer = (IODBLayer)step.GetLayer(sigLayer);

                    if (drill_layer.GetType() == typeof(IODBLayer))
                    {
                        AddDrillObjects(filter, drill_layer, type, odb_sig_layer);

                        drill_layer.EnableLayer(false);
                        odb_sig_layer.EnableLayer(true);
                    }
                }
            }

            matrix.UpdateDataAndList();
            Parent.UpdateControlsAndResetView();
        }
Esempio n. 21
0
        public void Execute(IPCBIWindow parent)
        {
            //your code here
            int count = 0;

            IStep step = parent.GetCurrentStep();

            IODBLayer outsideToplayer = step.GetOutsideODBLayer(true);
            IODBLayer outsideBotlayer = step.GetOutsideODBLayer(false);

            if (step.GetCMPLayer(true) != null)
            {
                step.GetCMPLayer(true).EnableLayer(true);
                foreach (ICMPObject cmp in step.GetCMPLayer(true).GetAllLayerObjects())
                {
                    foreach (IPin pin in cmp.GetPinList())
                    {
                        IODBObject po = pin.GetIPinPad(outsideToplayer, cmp);
                        if (po != null)
                        {
                            IPadSpecifics os = (IPadSpecifics)po.GetSpecifics();
                            if (os.Type == PCBI.Symbol_Type.r)
                            {
                                cmp.ObjectColor = Color.Red;
                                cmp.AddComponentAttribute("techno", "thr");
                                count++;

                                break;
                            }
                        }
                    }
                }
            }
            if (step.GetCMPLayer(false) != null)
            {
                step.GetCMPLayer(false).EnableLayer(true);
                foreach (ICMPObject cmp in step.GetCMPLayer(false).GetAllLayerObjects())
                {
                    foreach (IPin pin in cmp.GetPinList())
                    {
                        IODBObject po = pin.GetIPinPad(outsideBotlayer, cmp);
                        if (po != null)
                        {
                            IPadSpecifics os = (IPadSpecifics)po.GetSpecifics();
                            if (os.Type == PCBI.Symbol_Type.r)
                            {
                                cmp.ObjectColor = Color.Blue;
                                cmp.AddComponentAttribute("techno", "thr");
                                count++;

                                break;
                            }
                        }
                    }
                }
            }

            parent.UpdateView();
        }
Esempio n. 22
0
        public static void Execute(IPCBIWindow parent)
        {
            //check all selected lines, if lines on lines cut them

            IStep   step   = parent.GetCurrentStep();
            IFilter filter = new IFilter(parent);

            if (step == null)
            {
                return;
            }

            List <IODBObject> selectedElements = step.GetSelectedElements();

            PCB_Investigator.PCBIWindows.PCBIWorkingDialog working = new PCB_Investigator.PCBIWindows.PCBIWorkingDialog();
            StopCutting = false;
            working.SetStatusText("Working on splitting lines...");
            working.CancelPressed += Working_CancelPressed;
            working.CanCancel(true);
            working.SetAnimationStatus(false);

            working.ShowWorkingDlgAsThread();

            for (int i = 0; i < selectedElements.Count; i++)
            {
                if (StopCutting)
                {
                    break;
                }

                working.SetStatusPercent(i * 100 / selectedElements.Count);

                IODBObject evtlLine = selectedElements[i];
                if (evtlLine.Type != IObjectType.Line)
                {
                    continue;
                }

                ILineSpecificsD line = (ILineSpecificsD)evtlLine.GetSpecificsD();
                for (int j = i + 1; j < selectedElements.Count; j++)
                {
                    IODBObject evtlLine2 = selectedElements[j];
                    if (evtlLine2.Type != IObjectType.Line || evtlLine == evtlLine2)
                    {
                        continue;
                    }
                    ILineSpecificsD line2 = (ILineSpecificsD)evtlLine2.GetSpecificsD();

                    PointD crossingP = IMath.CrossingPoint(line.Start, line.End, line2.Start, line2.End, true);
                    if (PointD.InfPoint != crossingP)
                    {
                        CreateSplittedLines(step, filter, evtlLine2, line2, crossingP, ref selectedElements);
                        CreateSplittedLines(step, filter, evtlLine, line, crossingP, ref selectedElements);
                        line = (ILineSpecificsD)evtlLine.GetSpecificsD(); //changed, get it new
                    }
                }
            }
            working.DoClose();
        }
Esempio n. 23
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);
        }
        public void Execute(IPCBIWindow parent)
        {
            CreateNewLayer(parent, "ViaLayer");

            CopyAllViasToNewLayer(parent, "top", "ViaLayer");

            parent.UpdateView();
        }
        public void Execute(IPCBIWindow parent)
        {
            bool withRoutChecked = true;

            SplitDrillWorker worker = new SplitDrillWorker();

            worker.doWork(parent, withRoutChecked, false);
        }
        public void Execute(IPCBIWindow parent)
        {
            //your code here
            ExcelToPCBI excel = new ExcelToPCBI(parent);

            excel.ShowDialog();
            parent.UpdateView();
        }
        public void Execute(IPCBIWindow parent)
        {
            IStep     step          = parent.GetCurrentStep();
            IFilter   filter        = new IFilter(parent);
            IODBLayer layerPolygons = filter.CreateEmptyODBLayer("polygons_n", step.Name);

            bool polyStart = true;
            List <IODBObject> listOfSelection = step.GetSelectedElements();

            PCBI.MathUtils.IPolyClass poly = new PCBI.MathUtils.IPolyClass();

            foreach (IODBObject obj in listOfSelection)
            {
                IObjectSpecificsD os = obj.GetSpecificsD();

                if (os.GetType() == typeof(IArcSpecificsD))
                {
                    IArcSpecificsD aEdge = (IArcSpecificsD)os;

                    if (polyStart)
                    {
                        polyStart = false;
                    }
                    poly.AddEdge(aEdge.Start, aEdge.End, aEdge.Center, aEdge.ClockWise);
                }
                else if (os.GetType() == typeof(ILineSpecificsD))
                {
                    ILineSpecificsD aEdge = (ILineSpecificsD)os;
                    if (polyStart)
                    {
                        polyStart = false;
                    }
                    poly.AddEdge(aEdge.Start, aEdge.End);
                }
            }

            if (poly.GetSubPolygons().Count > 0)
            {
                foreach (PCBI.MathUtils.IPolyClass polyC in poly.GetSubPolygons())
                {
                    if (polyC.GetBounds().Width > 0.001 && polyC.GetBounds().Height > 0.001)
                    {
                        IODBObject surfaceFromPoly = polyC.GetSurfaceFromPolygon(layerPolygons);
                    }
                }
                layerPolygons.EnableLayer(true);
            }
            else
            {
                IODBObject suf = poly.GetSurfaceFromPolygon(layerPolygons);
                layerPolygons.EnableLayer(true);
            }

            parent.UpdateView();
            IMatrix matrix = parent.GetMatrix();

            matrix.UpdateDataAndList();
        }
        public void Execute(IPCBIWindow parent)
        {
            this.parent = parent;
            IStep step = parent.GetCurrentStep();

            if (step == null)
            {
                return;
            }

            List <string> columsStrings = new List <string>();

            columsStrings.Add("Analyse Resource");
            columsStrings.Add("Reference");
            columsStrings.Add("Distance");
            columsStrings.Add("Rule");
            columsStrings.Add("Start");
            columsStrings.Add("End");
            PCB_Investigator.PCBIWindows.PCBIResultDialog resultDLG = new PCB_Investigator.PCBIWindows.PCBIResultDialog(columsStrings);
            double unit     = 1;
            double distance = PCBI.MathUtils.IMath.MM2Mils(1.0f);

            if (parent.GetUnit())
            {
                unit = 25.4;
                //MessageBox.Show("Component to Outline distance: " + PCBI.MathUtils.IMath.Mils2MM(distance).ToString("N3") + " micron", "DRC Component to Board Outline");
            }
            else
            {
                //MessageBox.Show("Component to Outline distance: " + distance.ToString("N3") + " mils", "DRC Component to Board Outline");
                unit = 1;
            }
            foreach (ICMPObject cmp in step.GetAllCMPObjects())
            {
                PCBI.MathUtils.IPolyClass CMP_Poly = cmp.GetPolygonOutline(false);
                IODBObject boardOutline            = parent.GetCurrentStep().GetPCBOutlineAsODBObject();
                IPolyClass polyOutline             = boardOutline.GetPolygonOutline();
                PointD     start            = new PointD(0, 0);
                PointD     end              = new PointD(0, 0);
                double     measuredDistance = cmp.GetPolygonOutline().DistanceTo(polyOutline, ref start, ref end);
                if (measuredDistance < distance)
                {
                    ListViewItem lvi = new ListViewItem("Cpmp2Outline");
                    lvi.SubItems.Add(cmp.Ref);
                    lvi.SubItems.Add((measuredDistance * unit).ToString());
                    lvi.SubItems.Add((distance * unit).ToString());
                    lvi.SubItems.Add((start * unit).ToString());
                    lvi.SubItems.Add((end * unit).ToString());
                    lvi.Tag = cmp;
                    resultDLG.AddListViewItem(lvi);
                }
            }

            resultDLG.ItemSelectionChanged += ResultDLG_ItemSelectionChanged1;;
            resultDLG.Size = new Size(500, 350);
            resultDLG.Show();
        }
Esempio n. 29
0
 public void Execute(IPCBIWindow parent)
 {
     PCBI.Automation.IMatrix matrix = parent.GetMatrix();
     PCBI.Automation.IStep   step   = parent.GetCurrentStep();
     SetMatrixOrder(matrix, step);
     matrix.Save();
     parent.UpdateControlsAndResetView();
     parent.UpdateView();
     parent.UpdateView();
 }
 public void Execute(IPCBIWindow parent)
 {
     //your code here
     if (parent.JobIsLoaded)
     {
         List <string> columheader = new List <string>();
         columheader.Add("Layer Name");
         columheader.Add("Layer Thickness µm");
         columheader.Add("Layer Position µm");
         PCB_Investigator.PCBIWindows.PCBIResultDialog layerDlg = new PCBIResultDialog(columheader, "Matrix");
         IStep   step   = parent.GetCurrentStep();
         IMatrix matrix = parent.GetMatrix();
         //	bool toggle = true;
         foreach (string layername in matrix.GetAllLayerNames())
         {
             ListViewItem lvi = new ListViewItem(layername);
             // if (toggle)
             //  {
             //      lvi.BackColor = Color.LightBlue;
             //   }
             //  toggle = !toggle;
             if (matrix.GetMatrixLayerType(layername) == MatrixLayerType.Signal)
             {
                 lvi.BackColor = Color.Orange;
             }
             if (matrix.GetMatrixLayerType(layername) == MatrixLayerType.Power_ground)
             {
                 lvi.BackColor = Color.Orange;
             }
             if (matrix.GetMatrixLayerType(layername) == MatrixLayerType.Solder_mask)
             {
                 lvi.BackColor = Color.LightGreen;
             }
             if (matrix.GetMatrixLayerType(layername) == MatrixLayerType.Solder_paste)
             {
                 lvi.BackColor = Color.LightYellow;
             }
             if (matrix.GetMatrixLayerType(layername) == MatrixLayerType.Dielectric)
             {
                 lvi.BackColor = Color.GreenYellow;
             }
             if (matrix.GetMatrixLayerType(layername) == MatrixLayerType.Component)
             {
                 lvi.BackColor = Color.LightSteelBlue;
             }
             double Layerpos       = IMath.Mils2MM(MatrixHelpers.GetLayerPositionInStackUp(layername, step, matrix)) * 1000;
             double layerthickness = IMath.Mils2MM(step.GetHeightOfLayer(layername)) * 1000;
             lvi.SubItems.Add(layerthickness.ToString("N2"));
             lvi.SubItems.Add(Layerpos.ToString("N2"));
             layerDlg.AddListViewItem(lvi);
         }
         layerDlg.ShowDlg(PCBIResultDialog.WindowType.Modal);
         parent.UpdateView();
     }
 }