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();
        }
Exemplo n.º 3
0
        public void Execute(IPCBIWindow parent)
        {
            if (parent.GetCurrentStep() == null)
            {
                return;
            }
            IStep   step   = parent.GetCurrentStep();
            IFilter filter = new IFilter(parent);

            if (parent.GetCurrentStep() == null)
            {
                return;
            }

            if (step.GetCMPLayer(true) != null)
            {
                step.GetCMPLayer(true).EnableLayer(true);
            }
            if (step.GetCMPLayer(false) != null)
            {
                step.GetCMPLayer(false).EnableLayer(true);
            }
            double distance = PCBI.MathUtils.IMath.MM2Mils(0.5f);

            if (parent.GetUnit())
            {
                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");
            }
            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);

                if (cmp.GetPolygonOutline().DistanceTo(polyOutline, ref start, ref end) < distance)
                {
                    cmp.Select(true);
                }
            }
            parent.UpdateView();
        }
        public void Execute(IPCBIWindow parent)
        {
            if (parent.GetCurrentStep() == null)
            {
                return;
            }
            bool    clearLayer = false;
            IStep   step       = parent.GetCurrentStep();
            IFilter filter     = new IFilter(parent);

            if (parent.GetCurrentStep() == null)
            {
                return;
            }


            IODBLayer layerTopPins = null;
            IODBLayer layerbotPins = null;


            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);
                    }
                }
            }

            foreach (ICMPObject cmp in step.GetAllCMPObjects())
            {
                PCBI.MathUtils.IPolyClass CMP_Poly = cmp.GetPolygonOutline(false);

                IODBObject outlinePolygon;
                if (cmp.PlacedTop)
                {
                    outlinePolygon = filter.CreatePolygon(layerTopPins);
                }
                else
                {
                    outlinePolygon = filter.CreatePolygon(layerbotPins);
                }
                ISurfaceSpecifics CMP_Body_Polygon = (ISurfaceSpecifics)outlinePolygon.GetSpecifics();
                bool polyStart = true;
                foreach (IEdge edge in CMP_Poly.GetEdges())
                {
                    if (polyStart)
                    {
                        polyStart = false;
                        CMP_Body_Polygon.StartPolygon(false, new PointF((float)edge.Begin.X, (float)edge.Begin.Y));
                    }
                    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);
                        CMP_Body_Polygon.AddArc(start, end, center, aEdge.ClockWise);
                    }
                    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);
                        CMP_Body_Polygon.AddLine(start, end);
                    }
                }
                CMP_Body_Polygon.EndPolygon(); //close the new contour
                outlinePolygon.SetSpecifics(CMP_Body_Polygon);
            }
            layerbotPins.EnableLayer(true);
            layerTopPins.EnableLayer(true);
            parent.UpdateView();
            parent.UpdateControlsAndResetView();
        }
        void CreateForOneSide(bool top, IStep step, IFilter filter, string PackageName, List <string> DrillLayers)
        {
            ICMPLayer compLayer = step.GetCMPLayer(top);

            if (compLayer == null)
            {
                return;
            }

            IODBLayer newLayer = filter.CreateEmptyODBLayer("testpoint_locations_" + (top ? "top" : "bot"), step.Name);

            if (newLayer == null)
            {
                return;
            }

            List <IODBLayer> allDrillLayers = new List <IODBLayer>();

            foreach (string drillName in DrillLayers)
            {
                allDrillLayers.Add((IODBLayer)step.GetLayer(drillName));
            }

            int shapeIndex           = IFilter.AddToolDefinitionRound(newLayer, 75);
            int shapeIndexConnection = IFilter.AddToolDefinitionRound(newLayer, 1);

            foreach (ICMPObject cmp in compLayer.GetAllLayerObjects())
            {
                if (!cmp.UsedPackageName.Contains(PackageName))
                {
                    continue;
                }

                IODBObject     markerPad = filter.CreatePad(newLayer);
                IPadSpecificsD pad       = (IPadSpecificsD)markerPad.GetSpecificsD();

                pad.Location   = new PCBI.MathUtils.PointD(cmp.Position);
                pad.ShapeIndex = shapeIndex;

                markerPad.SetSpecifics(pad);
                markerPad.ObjectColor = Color.Green;
                markerPad.SetAttribute("Steel needle <BST> (Testpoint)");
                bool special = false;
                foreach (IODBLayer drillLayer in allDrillLayers)
                {
                    #region check drills
                    foreach (IODBObject drill in drillLayer.GetAllObjectsOnPosition(cmp.Position))
                    {
                        Dictionary <PCBI.FeatureAttributeEnum, string> attribs = drill.GetAttributesDictionary();

                        if (attribs.ContainsKey(PCBI.FeatureAttributeEnum.drill))
                        {
                            if (attribs[PCBI.FeatureAttributeEnum.drill].ToUpperInvariant() == "VIA")
                            {
                                markerPad.ObjectColor = Color.Blue;
                                markerPad.SetAttribute("Pyramid <H> (Via)");
                                special = true;
                                break;
                            }
                        }
                    }
                    if (special)
                    {
                        break;
                    }
                    #endregion
                }
                if (!special)
                {
                    //check for component pin
                    foreach (ICMPObject comp in compLayer.GetAllObjectsOnPosition(cmp.Position))
                    {
                        if (comp == cmp)
                        {
                            continue;              //testpunkt selbst wird ignoriert
                        }
                        foreach (IPin pin in comp.GetPinList())
                        {
                            PCBI.MathUtils.IPolyClass cmpPoly = pin.GetPolygonOutline(comp);
                            if (cmpPoly.PointInPolygon(pad.Location))
                            {
                                markerPad.ObjectColor = Color.Red;
                                markerPad.SetAttribute("Serrated <C>"); //hier evtl noch überprüfen ob pin bzw. body drüber liegt?
                                special = true;                         //oder Serrated with overlapping plastic <CS>
                                break;
                            }
                        }
                        if (special)
                        {
                            break;
                        }
                    }
                }
            }
            foreach (ICMPObject cmp in compLayer.GetAllLayerObjects()) //neue schleife da erst alle pads plaziert werden sollen!
            {
                if (!cmp.UsedPackageName.Contains(PackageName))
                {
                    continue;
                }

                IODBObject      textForPad = filter.CreateText(newLayer);
                ITextSpecificsD text       = (ITextSpecificsD)textForPad.GetSpecificsD();

                text.Text        = cmp.Ref.Remove(0, 2); //Annahme das alle mit TP beginnen
                text.TextSize    = new SizeF(25, 50);
                text.Location    = new PCBI.MathUtils.PointD(cmp.Position.X + 50, cmp.Position.Y - 10);
                text.WidthFactor = 0.6;
                textForPad.SetSpecifics(text);
                textForPad.ObjectColor = Color.DarkGray;

                //text location should not be intersecting!
                List <IObject> otherObjectsOnSameLocation = newLayer.GetAllObjectInRectangle(textForPad.GetBoundsD());
                int            offset     = 50;
                bool           horChecked = false;
                while (otherObjectsOnSameLocation.Count > 1)
                {
                    //move text
                    if (horChecked)
                    {
                        text.Location = new PCBI.MathUtils.PointD(cmp.Position.X, cmp.Position.Y + offset);
                    }
                    else
                    {
                        text.Location = new PCBI.MathUtils.PointD(cmp.Position.X - offset - textForPad.GetBoundsD().Width, cmp.Position.Y - 10);
                    }
                    offset    += 50;
                    horChecked = true;
                    textForPad.SetSpecifics(text);
                    otherObjectsOnSameLocation = newLayer.GetAllObjectInRectangle(textForPad.GetBoundsD());
                }

                IODBObject      connectionLine = filter.CreateLine(newLayer);
                ILineSpecificsD line           = (ILineSpecificsD)connectionLine.GetSpecificsD();

                line.ShapeIndex = shapeIndexConnection;
                line.Start      = new PCBI.MathUtils.PointD(cmp.Position);
                line.End        = new PCBI.MathUtils.PointD(text.Location.X, text.Location.Y + 25);
                connectionLine.SetSpecifics(line);
                connectionLine.ObjectColor = Color.LightGray;
            }
        }
        public void Execute(IPCBIWindow parent)
        {
            //set options here:
            bool   onlySelectedComponent = true;
            bool   CalculateTopSide      = true;
            bool   CalculateBotSide      = true;
            double TopArea = 0;
            double BotArea = 0;

            IStep step = parent.GetCurrentStep();

            if (step == null)
            {
                return;               //no project loaded
            }
            List <ICMPObject> allCMPs = step.GetAllCMPObjects();

            foreach (ICMPObject cmp in allCMPs)
            {
                if (onlySelectedComponent && !cmp.IsSelected)
                {
                    continue;
                }

                PCBI.MathUtils.IPolyClass polygonOfCMP = cmp.GetPolygonOutline();

                foreach (PCBI.MathUtils.IEdge edge in polygonOfCMP.GetEdges())
                {
                    if (!CalculateTopSide && cmp.PlacedTop)
                    {
                        continue;
                    }
                    if (!CalculateBotSide && !cmp.PlacedTop)
                    {
                        continue;
                    }

                    //work with integrals to calculate the area
                    double extent = 0;
                    if (edge.Type == IEdgeType.Line)
                    {
                        extent = PCBI.MathUtils.IMath.DistancePointToPoint(edge.Begin, edge.End);
                    }
                    else
                    {
                        // Pi * R * winkel /180
                        double angle  = PCBI.MathUtils.IMath.GetAngle(edge.Begin, edge.End, ((PCBI.MathUtils.IArcEdge)edge).Center, ((PCBI.MathUtils.IArcEdge)edge).ClockWise);
                        double radius = PCBI.MathUtils.IMath.DistancePointToPoint(edge.Begin, ((PCBI.MathUtils.IArcEdge)edge).Center);
                        extent = Math.PI * radius * angle / 180;
                    }
                    if (cmp.PlacedTop)
                    {
                        TopArea += extent * cmp.CompHEIGHT;
                    }
                    else
                    {
                        BotArea += extent * cmp.CompHEIGHT;
                    }
                }
            }

            double areaPCB = step.CalculateBoardArea();

            if (parent.GetUnit())              //change mils? to cm?
            {
                areaPCB = areaPCB / 155000.31; //(1/2.54*2.54)
                TopArea = TopArea / 155000.31;
                BotArea = BotArea / 155000.31;
            }

            System.Windows.Forms.MessageBox.Show((onlySelectedComponent ? "Selected Component side walls:" : "All side walls of Components:") + Environment.NewLine +
                                                 (CalculateTopSide ? "Top Side Components: " + TopArea + Environment.NewLine : "") +
                                                 (CalculateBotSide ? "Bot Side Components: " + BotArea + Environment.NewLine : "") +
                                                 ((!CalculateBotSide && !CalculateTopSide) ? "No Elements allowed, please run check with other parameters!" : "") + Environment.NewLine +
                                                 "Board Area " + areaPCB + (parent.GetUnit() ?  " cm?":" mils?")
                                                 , "Result", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
        }
        public void Execute(IPCBIWindow parent)
        {
            double sizeRouting  = PCBI.MathUtils.IMath.MM2Mils(2);   //2 mm
            double sizeCutout   = PCBI.MathUtils.IMath.MM2Mils(2);   //2 mm
            double spaceCutout  = PCBI.MathUtils.IMath.MM2Mils(100); //100 mm
            double lengthCutout = PCBI.MathUtils.IMath.MM2Mils(5);   //5 mm
            double sumUpLength  = 0;                                 //offset for start

            IStep step = parent.GetCurrentStep();

            if (step == null)
            {
                return;
            }

            PCBI.MathUtils.IPolyClass polyOfOutline = step.GetPCBOutlinePoly();

            if (polyOfOutline.GetEdgeCount() == 0)
            {
                return;
            }

            IFilter   filter              = new IFilter(parent);
            IODBLayer HelperLayer         = filter.CreateEmptyODBLayer("rout_outline_helper", step.Name); //this helper layer contains the uncutted line elements
            IODBLayer outlineLayerRouting = filter.CreateEmptyODBLayer("rout_outline", step.Name);
            IODBLayer cutoutLayerRouting  = filter.CreateEmptyODBLayer("rout_cutout", step.Name);

            #region clean layers for multi use
            List <IODBObject> objListToRemove = new List <IODBObject>();
            foreach (IODBObject obj in HelperLayer.GetAllLayerObjects())
            {
                objListToRemove.Add(obj);
            }
            HelperLayer.RemoveObjects(objListToRemove);

            objListToRemove = new List <IODBObject>();
            foreach (IODBObject obj in cutoutLayerRouting.GetAllLayerObjects())
            {
                objListToRemove.Add(obj);
            }
            cutoutLayerRouting.RemoveObjects(objListToRemove);

            objListToRemove = new List <IODBObject>();
            foreach (IODBObject obj in outlineLayerRouting.GetAllLayerObjects())
            {
                objListToRemove.Add(obj);
            }
            outlineLayerRouting.RemoveObjects(objListToRemove);
            #endregion

            int shapeIndexOutlinediameter = IFilter.AddToolDefinitionRound(HelperLayer, (float)sizeRouting);

            foreach (PCBI.MathUtils.IEdge edge in polyOfOutline.GetEdges())
            {
                #region outline elements
                if (edge.Type == IEdgeType.Arc)
                {
                    IODBObject newArc = filter.CreateArc(HelperLayer);

                    IArcSpecificsD arc = (IArcSpecificsD)newArc.GetSpecificsD();
                    arc.ClockWise = ((IArcEdge)edge).ClockWise;
                    if (arc.ClockWise)
                    {
                        arc.Start = edge.Begin;
                        arc.End   = edge.End;
                    }
                    else
                    {
                        arc.End   = edge.Begin;
                        arc.Start = edge.End;
                    }
                    arc.Center     = ((PCBI.MathUtils.IArcEdge)edge).Center;
                    arc.ShapeIndex = shapeIndexOutlinediameter;

                    newArc.SetSpecifics(arc);
                }
                else
                {
                    IODBObject newLine = filter.CreateLine(HelperLayer);

                    ILineSpecificsD line = (ILineSpecificsD)newLine.GetSpecificsD();

                    line.Start      = edge.Begin;
                    line.End        = edge.End;
                    line.ShapeIndex = shapeIndexOutlinediameter;

                    newLine.SetSpecifics(line);
                }
                #endregion
            }

            //make one surface of all lines and arcs
            HelperLayer.CreateLayerNetList(true);
            HelperLayer.PolygonizeLayer(0, false);

            PointD lastPToIdentifyHole = PointD.InfPoint;

            foreach (IODBObject surface in HelperLayer.GetAllLayerObjects())
            {
                #region replace surfaces by routing lines and arcs
                if (surface.Type != IObjectType.Surface)
                {
                    continue;
                }
                objListToRemove.Add(surface);
                List <ISurfaceSpecificsD> isle = ((ISurfaceSpecificsD)surface.GetSpecificsD()).SplitInIsleAndHoles(parent);

                if (isle.Count > 0)
                {
                    for (int i = 0; i < isle.Count; i++)
                    {
                        bool foundelement = false;
                        foreach (IODBObject linesAndArcs in isle[i].GetOutline())
                        {
                            if (linesAndArcs.Type == IObjectType.Arc)
                            {
                                #region arc
                                IODBObject     newArc = filter.CreateArc(HelperLayer);
                                IArcSpecificsD arc    = (IArcSpecificsD)linesAndArcs.GetSpecificsD();

                                if (lastPToIdentifyHole == PointD.InfPoint || !(lastPToIdentifyHole != arc.Start && lastPToIdentifyHole != arc.End))
                                {
                                    lastPToIdentifyHole = arc.End;
                                }
                                else
                                {
                                    break;
                                }
                                newArc.SetSpecifics(arc);
                                #endregion
                            }
                            else
                            {
                                #region line
                                IODBObject      newLine = filter.CreateLine(HelperLayer);
                                ILineSpecificsD line    = (ILineSpecificsD)linesAndArcs.GetSpecificsD();
                                if (lastPToIdentifyHole == PointD.InfPoint || line.Start == lastPToIdentifyHole)
                                {
                                    lastPToIdentifyHole = line.End;
                                }
                                else
                                {
                                    break;
                                }
                                newLine.SetSpecifics(line);
                                #endregion
                            }
                            foundelement = true;
                        }
                        if (foundelement)
                        {
                            break;
                        }
                    }
                }
                #endregion
            }
            HelperLayer.RemoveObjects(objListToRemove); //surface remove
            int    shapeIndexCutoutdiameter  = IFilter.AddToolDefinitionRound(outlineLayerRouting, (float)sizeCutout);
            int    shapeIndexCutoutdiameter2 = IFilter.AddToolDefinitionRound(cutoutLayerRouting, (float)sizeCutout);
            double sumUpGap = 0;

            foreach (IODBObject lineOrArc in HelperLayer.GetAllLayerObjects())
            {
                if (lineOrArc.Type == IObjectType.Line)
                {
                    #region lines
                    ILineSpecificsD line           = (ILineSpecificsD)lineOrArc.GetSpecificsD();
                    double          length         = IMath.DistancePointToPoint(line.Start, line.End);
                    double          lengthComplete = length;
                    while (true)
                    {
                        if (length <= lengthCutout)
                        {
                            #region short lines
                            sumUpLength += lengthCutout;
                            if (sumUpLength > spaceCutout)
                            {
                                sumUpGap += lengthCutout;
                                IODBObject      lineObj = filter.CreateLine(cutoutLayerRouting);
                                ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD();
                                lineSub.ShapeIndex = shapeIndexCutoutdiameter2;
                                lineSub.Start      = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);
                                length             = 0;
                                lineSub.End        = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);
                                lineObj.SetSpecifics(lineSub);
                                if (sumUpGap > lengthCutout)
                                {
                                    sumUpGap    = 0;
                                    sumUpLength = 0;
                                }

                                IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp);
                                attribRoutningComp.Value = "none";
                                IAttribute.SetAttribute(attribRoutningComp, lineObj);
                            }
                            else
                            {
                                IODBObject      lineObj = filter.CreateLine(outlineLayerRouting);
                                ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD();
                                lineSub.ShapeIndex = shapeIndexCutoutdiameter;
                                lineSub.Start      = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);
                                length             = 0;
                                lineSub.End        = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);
                                lineObj.SetSpecifics(lineSub);

                                IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp);
                                attribRoutningComp.Value = "none";
                                IAttribute.SetAttribute(attribRoutningComp, lineObj);
                            }
                            break;
                            #endregion
                        }
                        else
                        {
                            #region long lines
                            sumUpLength += lengthCutout;
                            if (sumUpLength > spaceCutout || sumUpGap > 0)
                            {
                                sumUpGap += lengthCutout;
                                IODBObject lineObj = filter.CreateLine(cutoutLayerRouting);

                                ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD();
                                lineSub.ShapeIndex = shapeIndexCutoutdiameter2;
                                lineSub.Start      = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);
                                length            -= lengthCutout;
                                lineSub.End        = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);

                                lineObj.SetSpecifics(lineSub);
                                if (sumUpGap > lengthCutout)
                                {
                                    sumUpGap    = 0;
                                    sumUpLength = 0;
                                }

                                IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp);
                                attribRoutningComp.Value = "none";
                                IAttribute.SetAttribute(attribRoutningComp, lineObj);
                            }
                            else
                            {
                                IODBObject lineObj = filter.CreateLine(outlineLayerRouting);

                                ILineSpecificsD lineSub = (ILineSpecificsD)lineOrArc.GetSpecificsD();
                                lineSub.ShapeIndex = shapeIndexCutoutdiameter;
                                lineSub.Start      = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);
                                length            -= lengthCutout;
                                lineSub.End        = IMath.GetPointOnLine(line.Start, line.End, lengthComplete - length);

                                lineObj.SetSpecifics(lineSub);

                                IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp);
                                attribRoutningComp.Value = "none";
                                IAttribute.SetAttribute(attribRoutningComp, lineObj);
                            }
                            #endregion
                        }
                    }
                    #endregion
                }
                else if (lineOrArc.Type == IObjectType.Arc)
                {
                    #region arcs
                    IArcSpecificsD arc       = (IArcSpecificsD)lineOrArc.GetSpecificsD();
                    double         arcLength = IMath.DistancePointToPoint(arc.Start, arc.End);

                    sumUpLength += arcLength;

                    if (sumUpLength > spaceCutout || sumUpGap > 0)
                    {
                        sumUpGap += arcLength;
                        IODBObject arcObj = filter.CreateArc(cutoutLayerRouting);
                        arc.ShapeIndex = shapeIndexCutoutdiameter2;
                        arcObj.SetSpecifics(arc);
                        if (sumUpGap > lengthCutout)
                        {
                            sumUpGap    = 0;
                            sumUpLength = 0;
                        }
                        IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp);
                        attribRoutningComp.Value = "none";
                        IAttribute.SetAttribute(attribRoutningComp, arcObj);
                    }
                    else
                    {
                        IODBObject arcObj = filter.CreateArc(outlineLayerRouting);
                        arc.ShapeIndex = shapeIndexCutoutdiameter;
                        arcObj.SetSpecifics(arc);
                        IAttributeElement attribRoutningComp = new IAttributeElement(PCBI.FeatureAttributeEnum.comp);
                        attribRoutningComp.Value = "none";
                        IAttribute.SetAttribute(attribRoutningComp, arcObj);
                    }
                    #endregion
                }
            }
            //additional attributes are .feed, .speed, .rout_flag, .comp. and .rout_chain

            IMatrix matrix = parent.GetMatrix();
            if (matrix != null)
            {
                matrix.UpdateDataAndList();
            }
            parent.UpdateView();
        }