Exemplo n.º 1
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);
                    }
                }
            }
        }
        private void CopyAllViasToNewLayer(IPCBIWindow parent, string layerName, string newLayerName)
        {
            IStep curStep = parent.GetCurrentStep();

            if (curStep == null)
            {
                MessageBox.Show("No Job loaded, please load a job before start this script!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            ILayer relevantLayer = curStep.GetLayer(layerName);
            ILayer NewLayer      = curStep.GetLayer(newLayerName);

            if (NewLayer == null || relevantLayer == null || !(NewLayer is IODBLayer))
            {
                MessageBox.Show("Check Layers, something is wrong!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            List <IODBObject> ViaList = new List <IODBObject>();

            //check all elements for via attribute
            foreach (IObject obj in relevantLayer.GetAllLayerObjects())
            {
                if (obj is IODBObject)
                {
                    if (((IODBObject)obj).Type == IObjectType.Pad)
                    {
                        Dictionary <PCBI.FeatureAttributeEnum, string> attributesOfPad = ((IODBObject)obj).GetAttributesDictionary();

                        if (attributesOfPad.ContainsKey(PCBI.FeatureAttributeEnum.pad_usage))
                        {
                            if (attributesOfPad[PCBI.FeatureAttributeEnum.pad_usage] == "via")
                            {
                                ViaList.Add((IODBObject)obj);
                            }
                        }
                    }
                }
            }
            IFilter filter = new IFilter(parent); //to create copies on new layer

            //add vias to new layer
            foreach (IODBObject viaPad in ViaList)
            {
                IPadSpecificsD padInfo = (IPadSpecificsD)viaPad.GetSpecificsD();

                int toolNr = IFilter.AddToolDefinitionRound((IODBLayer)NewLayer, (float)padInfo.Diameter, -1);

                IODBObject newViaPad = filter.CreatePad((IODBLayer)NewLayer);

                newViaPad.SetSpecifics(padInfo, toolNr);
                newViaPad.SetAttribute("pad_usage=via");
            }
        }
Exemplo n.º 3
0
        public void CreateCopperLines()
        {
            IFilter filter = new IFilter(Parent);

            IStep curStep = Parent.GetCurrentStep();

            if (curStep == null)
            {
                MessageBox.Show("No Job loaded, please load a job before start this script!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                return;
            }
            IODBLayer fiducialLayer = filter.CreateEmptyODBLayer("copper", curStep.Name);

            if (fiducialLayer == null)
            {
                MessageBox.Show("Can't create new layer!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                return;
            }

            float outerDiameter = 1800;

            int shapeIndex = IFilter.AddToolDefinitionRound(fiducialLayer, outerDiameter / 25.4f, 0);

            PCBI.MathUtils.PointD startLine = new PCBI.MathUtils.PointD(0, 0);
            float distance = 2540 / 25.4f;

            for (int y = 0; y < 39; y++)
            {
                float lastX = 0;
                for (int i = 0; i < 63; i++)
                {
                    IODBObject      line = filter.CreateLine(fiducialLayer);
                    ILineSpecificsD ps   = new ILineSpecificsD();
                    ps.Start = new PCBI.MathUtils.PointD(startLine.X, startLine.Y);
                    float lineEnd = lastX + distance;
                    ps.End        = new PCBI.MathUtils.PointD(lineEnd, startLine.Y);
                    lastX         = lineEnd;
                    ps.ShapeIndex = shapeIndex;
                    ps.Positive   = true;
                    line.SetSpecifics(ps);
                    startLine.X += distance;
                }
                startLine.Y += distance;
                startLine.X  = 0;
            }
            IMatrix matrix = Parent.GetMatrix();

            matrix.UpdateDataAndList();
            Parent.UpdateView();
        }
        /// <summary>
        /// Helper to create Symbols only once.
        /// </summary>
        private static int CheckShapeIndexRound(IFilter pcbiFilter, IODBLayer parentLayer, float thickness)
        {
            int shapeIndex = -1;
            Dictionary <int, PCBI.Automation.IFilter.ToolDefinition> symbolList = pcbiFilter.GetUsedSymbolList(parentLayer);

            foreach (KeyValuePair <int, PCBI.Automation.IFilter.ToolDefinition> symbs in symbolList)
            {
                if (symbs.Value.Diameter == thickness &&
                    symbs.Value.Type == PCBI.Symbol_Type.r)
                {
                    return(symbs.Key);
                }
            }

            shapeIndex = IFilter.AddToolDefinitionRound(parentLayer, thickness);

            return(shapeIndex);
        }
        public void Execute(IPCBIWindow parent)
        {
            string PackageName    = "TESTPUNKT";
            bool   topSide        = true;
            bool   useFlattenStep = true;

            if (!parent.JobIsLoaded)
            {
                return;
            }
            IFilter filter = new IFilter(parent);
            IStep   step   = parent.GetCurrentStep();
            IMatrix matrix = parent.GetMatrix();

            if (matrix == null)
            {
                return;
            }

            step.TurnOffAllLayer();
            step.ClearSelection();
            //nicht für flatten step, da durch Threads zu langsam und dann evtl die neuen Daten wieder gelöscht werden!
            if (!useFlattenStep)
            {
                matrix.DelateLayer("testpoint_locations_top", false);
                matrix.DelateLayer("testpoint_locations_bot", false);
            }
            if (topSide)
            {
                CreateForOneSide(true, step, filter, PackageName, matrix.GetAllDrillLayersForThisLayer(matrix.GetTopSignalLayer()));
            }
            else
            {
                CreateForOneSide(false, step, filter, PackageName, matrix.GetAllDrillLayersForThisLayer(matrix.GetBotSignalLayer()));
            }

            //gitter 500x500

            IODBLayer  rasterLayer = filter.CreateEmptyODBLayer("raster", step.Name);
            int        shapeIndex  = IFilter.AddToolDefinitionRound(rasterLayer, 10);
            RectangleF boundsStep  = step.GetBounds();

            int countYLines = (int)(boundsStep.Height / 500) + 1;
            int countXLines = (int)(boundsStep.Width / 500) + 1;

            for (int y = 0; y <= countYLines; y++)
            {
                for (int x = 0; x <= countXLines; x++)
                {
                    for (int i = 0; i < 5; i++) //5 sublines
                    {
                        int yVal = y * 500;
                        int xVal = x * 500;
                        if (x < countXLines)
                        {
                            CreateHorLine(filter, rasterLayer, shapeIndex, yVal, xVal + i * 100 + 25);
                        }
                        if (y < countYLines)
                        {
                            CreateVertLine(filter, rasterLayer, shapeIndex, yVal + i * 100 + 25, xVal);
                        }
                    }
                }
            }

            for (int y = 0; y < countYLines; y++)
            {
                #region draw text
                IODBObject      textForPad = filter.CreateText(rasterLayer);
                ITextSpecificsD text       = (ITextSpecificsD)textForPad.GetSpecificsD();

                text.Text        = "Y" + (y + 1);
                text.TextSize    = new SizeF(50, 80);
                text.Location    = new PCBI.MathUtils.PointD(-120, y * 500 + 200);
                text.WidthFactor = 1;
                textForPad.SetSpecifics(text);

                //right side
                IODBObject      textForPad2 = filter.CreateText(rasterLayer);
                ITextSpecificsD text2       = (ITextSpecificsD)textForPad.GetSpecificsD();

                text2.Text        = text.Text;
                text2.TextSize    = new SizeF(50, 80);
                text2.Location    = new PCBI.MathUtils.PointD(countXLines * 500 + 120, y * 500 + 200);
                text2.WidthFactor = 1;
                textForPad2.SetSpecifics(text2);
            }
            for (int x = 0; x < countXLines; x++)
            {
                IODBObject      textForPad = filter.CreateText(rasterLayer);
                ITextSpecificsD text       = (ITextSpecificsD)textForPad.GetSpecificsD();

                text.Text        = "X" + (x + 1);
                text.TextSize    = new SizeF(50, 80);
                text.Location    = new PCBI.MathUtils.PointD(x * 500 + 200, -100);
                text.Rotation    = -90;
                text.WidthFactor = 1;
                textForPad.SetSpecifics(text);

                //top side
                IODBObject      textForPad2 = filter.CreateText(rasterLayer);
                ITextSpecificsD text2       = (ITextSpecificsD)textForPad.GetSpecificsD();

                text2.Text        = text.Text;
                text2.TextSize    = new SizeF(50, 80);
                text2.Location    = new PCBI.MathUtils.PointD(x * 500 + 300, countYLines * 500 + 100);
                text2.Rotation    = 90;
                text2.WidthFactor = 1;
                textForPad2.SetSpecifics(text2);
                #endregion
            }

            foreach (string drillName in matrix.GetAllDrillLayerNames())
            {
                IODBLayer drillLayer = (IODBLayer)step.GetLayer(drillName);

                foreach (IODBObject drill in drillLayer.GetAllLayerObjects())
                {
                    Dictionary <PCBI.FeatureAttributeEnum, string> attribs = drill.GetAttributesDictionary();

                    if (drill.Type == IObjectType.Pad && attribs.ContainsKey(PCBI.FeatureAttributeEnum.drill) && attribs.ContainsKey(PCBI.FeatureAttributeEnum.geometry))
                    {
                        if (attribs[PCBI.FeatureAttributeEnum.drill].ToUpperInvariant() == "NON_PLATED" && attribs[PCBI.FeatureAttributeEnum.geometry].ToUpperInvariant() == "ICTAUFNAHME")
                        {
                            IODBObject     drillMarker = filter.CreatePad(rasterLayer);
                            IPadSpecificsD drillSpec   = (IPadSpecificsD)drill.GetSpecificsD();

                            int shapeIndexNew = IFilter.AddToolDefinitionRound(rasterLayer, (float)drillSpec.Diameter);
                            drillSpec.ShapeIndex = shapeIndexNew;
                            drillMarker.SetSpecifics(drillSpec);
                        }
                    }
                }
            }

            matrix.UpdateDataAndList();

            if (!useFlattenStep)
            {
                parent.UIAction.Execute(ID_ActionItem.ID_PRINT_PREVIEW);
            }
        }
        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)
        {
            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();
        }