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();
        }
예제 #2
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();
        }
        public void Execute(IPCBIWindow parent)
        {
            IStep     step   = parent.GetCurrentStep();
            IODBLayer layer  = (IODBLayer)step.GetLayer("top");
            IFilter   filter = new IFilter(parent);

            // Pins
            foreach (ICMPObject cmp in step.GetAllCMPObjects())
            {
                foreach (IPin pin in cmp.GetPinList())
                {
                    IODBObject        outlinePolygon = filter.CreatePolygon(layer);
                    ISurfaceSpecifics specOutline    = (ISurfaceSpecifics)outlinePolygon.GetSpecifics();
                    bool   polyStart  = true;
                    PointF StartPoint = new PointF(0, 0);
                    PointF EndPoint   = new PointF(0, 0);
                    foreach (IEdge edge in pin.GetPolygonOutline(cmp).GetEdges())
                    {
                        if (polyStart)
                        {
                            polyStart  = false;
                            StartPoint = new PointF((float)edge.Begin.X, (float)edge.Begin.Y);
                            specOutline.StartPolygon(false, StartPoint);


                            if (edge is IArcEdge)
                            {
                                IArcEdge aEdge  = (IArcEdge)edge;
                                PointF   start  = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                                PointF   end    = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                                PointF   center = new PointF((float)aEdge.Center.X, (float)aEdge.Center.Y);
                                specOutline.AddArc(start, end, center, aEdge.ClockWise);
                                if (aEdge.ClockWise)
                                {
                                    EndPoint = end;
                                }
                                else
                                {
                                    EndPoint = start;
                                }
                            }
                            else if (edge is ILineEdge)
                            {
                                ILineEdge aEdge = (ILineEdge)edge;
                                PointF    start = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                                PointF    end   = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                                specOutline.AddLine(start, end);
                                EndPoint = end;
                            }
                        }
                        else
                        if (edge is IArcEdge)
                        {
                            IArcEdge aEdge  = (IArcEdge)edge;
                            PointF   start  = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                            PointF   end    = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                            PointF   center = new PointF((float)aEdge.Center.X, (float)aEdge.Center.Y);
                            specOutline.AddArc(start, end, center, aEdge.ClockWise);
                            if (aEdge.ClockWise)
                            {
                                EndPoint = end;
                            }
                            else
                            {
                                EndPoint = start;
                            }
                        }
                        else if (edge is ILineEdge)
                        {
                            ILineEdge aEdge = (ILineEdge)edge;
                            PointF    start = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                            PointF    end   = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                            specOutline.AddLine(start, end);
                            EndPoint = end;
                        }
                    }
                    //specOutline.AddLine(EndPoint, StartPoint);
                    specOutline.EndPolygon(); //close the new contour
                    outlinePolygon.SetSpecifics(specOutline);
                }
            }
            parent.UpdateView();
        }
예제 #4
0
        public void Execute(IPCBIWindow parent)
        {
            if (parent.GetCurrentStep() == null)
            {
                return;
            }
            bool      clearLayer   = false;
            IStep     step         = parent.GetCurrentStep();
            IODBLayer layerTopPins = null;
            IODBLayer layerbotPins = null;
            IFilter   filter       = new IFilter(parent);

            if (layerTopPins == null)
            {
                layerTopPins = filter.CreateEmptyODBLayer("component_top_shapes", step.Name);
                if (clearLayer)
                {
                    foreach (IODBObject o in layerTopPins.GetAllLayerObjects())
                    {
                        layerTopPins.RemoveObject(o);
                    }
                }
            }

            if (layerbotPins == null)
            {
                layerbotPins = filter.CreateEmptyODBLayer("component_bot_shapes", step.Name);
                if (clearLayer)
                {
                    foreach (IODBObject o in layerbotPins.GetAllLayerObjects())
                    {
                        layerbotPins.RemoveObject(o);
                    }
                }
            }

            // Pins
            foreach (ICMPObject cmp in step.GetAllCMPObjects())
            {
                foreach (IPin pin in cmp.GetPinList())
                {
                    IODBObject outlinePolygon = null;
                    if (cmp.PlacedTop)
                    {
                        outlinePolygon = filter.CreatePolygon(layerTopPins);
                    }
                    else
                    {
                        outlinePolygon = filter.CreatePolygon(layerbotPins);
                    }

                    ISurfaceSpecifics specOutline = (ISurfaceSpecifics)outlinePolygon.GetSpecifics();
                    bool   polyStart  = true;
                    PointF StartPoint = new PointF(0, 0);
                    PointF EndPoint   = new PointF(0, 0);
                    foreach (IEdge edge in pin.GetPolygonOutline(cmp).GetEdges())
                    {
                        if (polyStart)
                        {
                            polyStart  = false;
                            StartPoint = new PointF((float)edge.Begin.X, (float)edge.Begin.Y);
                            specOutline.StartPolygon(false, StartPoint);

                            if (edge is IArcEdge)
                            {
                                IArcEdge aEdge  = (IArcEdge)edge;
                                PointF   start  = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                                PointF   end    = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                                PointF   center = new PointF((float)aEdge.Center.X, (float)aEdge.Center.Y);
                                specOutline.AddArc(start, end, center, aEdge.ClockWise);
                                if (aEdge.ClockWise)
                                {
                                    EndPoint = end;
                                }
                                else
                                {
                                    EndPoint = start;
                                }
                            }
                            else if (edge is ILineEdge)
                            {
                                ILineEdge aEdge = (ILineEdge)edge;
                                PointF    start = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                                PointF    end   = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                                specOutline.AddLine(start, end);
                                EndPoint = end;
                            }
                        }
                        else
                        if (edge is IArcEdge)
                        {
                            IArcEdge aEdge  = (IArcEdge)edge;
                            PointF   start  = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                            PointF   end    = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                            PointF   center = new PointF((float)aEdge.Center.X, (float)aEdge.Center.Y);
                            specOutline.AddArc(start, end, center, aEdge.ClockWise);
                            if (aEdge.ClockWise)
                            {
                                EndPoint = end;
                            }
                            else
                            {
                                EndPoint = start;
                            }
                        }
                        else if (edge is ILineEdge)
                        {
                            ILineEdge aEdge = (ILineEdge)edge;
                            PointF    start = new PointF((float)aEdge.Begin.X, (float)aEdge.Begin.Y);
                            PointF    end   = new PointF((float)aEdge.End.X, (float)aEdge.End.Y);
                            specOutline.AddLine(start, end);
                            EndPoint = end;
                        }
                    }

                    specOutline.EndPolygon();                     //close the new contour
                    outlinePolygon.SetSpecifics(specOutline);
                    outlinePolygon.ObjectColor = Color.Blue;
                }
            }
            layerbotPins.EnableLayer(true);
            layerTopPins.EnableLayer(true);
            parent.UpdateView();
            parent.UpdateControlsAndResetView();
        }