Exemple #1
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();
        }
        private static void CreateBoardView(IStep step, IFilter filter, IODBLayer frontLayer, float boardThickness, bool front)
        {
            if (boardThickness > 0)
            {
                #region draw board front
                int shapeIndexBoardHeight = IFilter.AddToolDefinitionRect(frontLayer, boardThickness, boardThickness, boardThickness, false);

                //add line with board symbol index to have correct thickness
                IODBObject boardLineFront = filter.CreateLine(frontLayer);

                ILineSpecificsD lineDetails = (ILineSpecificsD)boardLineFront.GetSpecificsD();
                if (front)
                {
                    lineDetails.Start = new PointD(step.GetBoundsD().Left + boardThickness / 2, 0);
                    lineDetails.End   = new PointD(step.GetBoundsD().Right - boardThickness / 2, 0);
                }
                else
                {
                    lineDetails.Start = new PointD(0, step.GetBoundsD().Top + boardThickness / 2);
                    lineDetails.End   = new PointD(0, step.GetBoundsD().Bottom - boardThickness / 2);
                }
                boardLineFront.SetSpecifics(lineDetails, shapeIndexBoardHeight);
                boardLineFront.ObjectColorTemporary(Color.Green);
                #endregion
            }
        }
        private static void CreateVertLine(IFilter filter, IODBLayer rasterLayer, int shapeIndex, int y, int x)
        {
            IODBObject      rasterLine = filter.CreateLine(rasterLayer);
            ILineSpecificsD line       = (ILineSpecificsD)rasterLine.GetSpecificsD();

            line.Start      = new PCBI.MathUtils.PointD(x, y);
            line.End        = new PCBI.MathUtils.PointD(x, y + 50);
            line.ShapeIndex = shapeIndex;

            rasterLine.SetSpecifics(line);
        }
        private void SetOriginBotLeft(IPCBIWindow parent)
        {
            IStep              step           = parent.GetCurrentStep();
            IMatrix            PCB_Matrix     = parent.GetMatrix();
            IODBObject         profile        = step.GetPCBOutlineAsODBObject();
            ISurfaceSpecificsD profileSurface = (ISurfaceSpecificsD)profile.GetSpecificsD();;

            RectangleD profileRect = profileSurface.GetBounds();
            PointD     OriginPoint = new PointD(-profileRect.Left, -profileRect.Top);;

            foreach (string layerName in PCB_Matrix.GetAllBoardLayerNames(true))
            {
                step.GetLayer(layerName).MoveLayer(OriginPoint.ToPointF());
            }
            profile.SetOffset(OriginPoint);

            parent.UpdateView();
        }
        public void Execute(IPCBIWindow parent)
        {
            IStep step = parent.GetCurrentStep();

            if (step == null)
            {
                return;
            }

            if (step.GetSelectedElementsCount() == 2) //this script is optimiezd for two line elements
            {
                List <IODBObject> selectedElements = step.GetSelectedElements();

                IODBObject obj1 = selectedElements[0];
                IODBObject obj2 = selectedElements[1];

                bool firstArc  = false;
                bool secondArc = false;
                if (obj1.Type == IObjectType.Arc)
                {
                    firstArc = true;
                }
                if (obj2.Type == IObjectType.Arc)
                {
                    secondArc = true;
                }

                if (!firstArc && obj1.Type != IObjectType.Line)
                {
                    return;
                }
                else if (!secondArc && obj2.Type != IObjectType.Line)
                {
                    return;
                }
                ILineSpecificsD obS1;
                ILineSpecificsD obS2;
                if (firstArc)
                {
                    obS1 = new ILineSpecificsD();

                    IArcSpecificsD arcS1 = (IArcSpecificsD)obj1.GetSpecificsD();
                    obS1.Start = arcS1.Start;
                    obS1.End   = arcS1.End;
                }
                else
                {
                    obS1 = (ILineSpecificsD)obj1.GetSpecificsD();
                }
                if (secondArc)
                {
                    obS2 = new ILineSpecificsD();

                    IArcSpecificsD arcS2 = (IArcSpecificsD)obj2.GetSpecificsD();
                    obS2.Start = arcS2.Start;
                    obS2.End   = arcS2.End;
                }
                else
                {
                    obS2 = (ILineSpecificsD)obj2.GetSpecificsD();
                }

                //make simple check for crossing point, this is nearly correct for arc endings
                PCBI.MathUtils.PointD crossingPoint = PCBI.MathUtils.IMath.CrossingPoint(obS1.Start, obS1.End, obS2.Start, obS2.End, false);

                if (PCBI.MathUtils.PointD.InfPoint == crossingPoint)
                {
                    return;                                                  //parallel lines do not work
                }
                #region set ends of lines to the crossing Point

                if (!firstArc)
                {
                    if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.Start))
                    {
                        obS1.End = crossingPoint;
                    }
                    else
                    {
                        obS1.Start = crossingPoint;
                    }

                    obj1.SetSpecifics(obS1);
                }
                else
                {
                    //special case for arc
                    IArcSpecificsD arcS1 = (IArcSpecificsD)obj1.GetSpecificsD();
                    if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS1.Start))
                    {
                        arcS1.End = crossingPoint;
                    }
                    else
                    {
                        arcS1.Start = crossingPoint;
                    }

                    obj1.SetSpecifics(arcS1);
                    obj1.UpdateInternal();
                }

                if (!secondArc)
                {
                    if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS2.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, obS2.Start))
                    {
                        obS2.End = crossingPoint;
                    }
                    else
                    {
                        obS2.Start = crossingPoint;
                    }

                    obj2.SetSpecifics(obS2);
                }
                else
                {
                    //special case for arc
                    IArcSpecificsD arcS2 = (IArcSpecificsD)obj2.GetSpecificsD();
                    if (PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, arcS2.End) < PCBI.MathUtils.IMath.DistancePointToPoint(crossingPoint, arcS2.Start))
                    {
                        arcS2.End = crossingPoint;
                    }
                    else
                    {
                        arcS2.Start = crossingPoint;
                    }

                    obj2.SetSpecifics(arcS2);
                    obj2.UpdateInternal();
                }
                #endregion
            }

            parent.UpdateView();
        }
        public void Execute(IPCBIWindow parent)
        {
            IFilter filter = new IFilter(parent);

            IStep curStep = parent.GetCurrentStep();

            if (curStep == null)
            {
                return;
            }

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

            //create list with all selected elements to make a new symbol of it
            List <IObjectSpecificsD> newSymbolSpecs = new List <IObjectSpecificsD>();
            string relLayerName = "";

            PCBI.MathUtils.RectangleD bounds = new PCBI.MathUtils.RectangleD();
            int indexOfLastElement           = 1;

            foreach (IODBObject obj in selectedElements)
            {
                newSymbolSpecs.Add(obj.GetSpecificsD());
                relLayerName = obj.GetParentLayerName();
                if (bounds == RectangleD.Empty)
                {
                    bounds = obj.GetBoundsD();
                }
                else
                {
                    bounds = PCBI.MathUtils.RectangleD.Union(bounds, obj.GetBoundsD());
                }
                indexOfLastElement = obj.GetIndexOnLayer();
            }

            IODBLayer relLayer = (IODBLayer)curStep.GetLayer(relLayerName);

            if (relLayer == null)
            {
                return;
            }

            //create new symbol for pads, the name must be unique. We try it with the index of one of the elements.
            int nr = IFilter.AddToolDefinitionSpecial(relLayer, parent, "testsymbol3" + indexOfLastElement, newSymbolSpecs, -bounds.GetMidPoint().X, -bounds.GetMidPoint().Y);

            if (nr < 0)
            {
                //no new symbol was created, maybe name is already existing
                return;
            }

            //delete old elements
            IAutomation.SuppressUserNotifications = false; //otherwise the delete action will be blocked
            parent.UIAction.Execute(ID_ActionItem.ID_DELETE);

            IODBObject pad = filter.CreatePad(relLayer);

            IPadSpecificsD padSpec = (IPadSpecificsD)pad.GetSpecificsD();

            padSpec.Location = bounds.GetMidPoint();
            pad.SetSpecifics(padSpec, nr);
            pad.SetAttribute("new symbol attribute");

            pad.Select(true);

            parent.UpdateView();
        }
        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;
            }
        }
        private static void CreateComponents(bool top, ICMPLayer CMPLayer, IODBLayer frontLayer, IODBLayer sideLayer, float offset, IFilter filter, bool allValuesInMM)
        {
            if (CMPLayer == null)
            {
                return;
            }
            foreach (ICMPObject component in CMPLayer.GetAllLayerObjects())
            {
                float height = (float)component.CompHEIGHT;
                IPackageSpecificsD usedPackage = component.GetPackageSpecificsD();
                if (height == 0)
                {
                    height = usedPackage.Height;
                }
                if (height == 0)
                {
                    #region check height
                    //check attributes
                    foreach (string attrib in component.GetComponentAttributes())
                    {
                        if (attrib.ToLowerInvariant().Contains("height"))
                        {
                            string[] attribtValueFinder = attrib.Split('=');

                            if (attribtValueFinder.Length > 1)
                            {
                                float.TryParse(attribtValueFinder[1], System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out height);
                            }
                            else if (attribtValueFinder[0].Contains("\'"))
                            {
                                string subStr = attribtValueFinder[0].Substring(attribtValueFinder[0].IndexOf('\'') + 1);
                                if (subStr.Contains("\'"))
                                {
                                    subStr = subStr.Substring(0, subStr.IndexOf('\''));
                                    float.TryParse(subStr, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out height);
                                }
                            }
                        }
                    }
                    #endregion
                }
                if (allValuesInMM)
                {
                    height = (float)IMath.MM2Mils(height);
                }

                #region front layer
                int componentFront = IFilter.AddToolDefinitionRect(frontLayer, (float)component.Bounds.Width, height, (float)component.Bounds.Width, false);

                IODBObject cmpFront = filter.CreatePad(frontLayer);

                IPadSpecificsD padCMPFront = (IPadSpecificsD)cmpFront.GetSpecificsD();

                if (top)
                {
                    padCMPFront.Location = new PointD(component.Bounds.X + component.Bounds.Width / 2, offset + height / 2);
                }
                else
                {
                    padCMPFront.Location = new PointD(component.Bounds.X + component.Bounds.Width / 2, -(offset + height / 2));
                }

                cmpFront.SetSpecifics(padCMPFront, componentFront);
                cmpFront.FreeText = component.Ref;
                if (top)
                {
                    cmpFront.ObjectColorTemporary(Color.Silver);
                }
                else
                {
                    cmpFront.ObjectColorTemporary(Color.Gray);
                }
                #endregion
                #region side layer
                int componentSide = IFilter.AddToolDefinitionRect(sideLayer, (float)component.Bounds.Height, (float)component.Bounds.Height, height, false);

                IODBObject cmpSide = filter.CreatePad(sideLayer);

                IPadSpecificsD padCMPSide = (IPadSpecificsD)cmpSide.GetSpecificsD();

                if (top)
                {
                    padCMPSide.Location = new PointD(offset + height / 2, component.Bounds.Y + component.Bounds.Height / 2);
                }
                else
                {
                    padCMPSide.Location = new PointD(-(offset + height / 2), component.Bounds.Y + component.Bounds.Height / 2);
                }

                cmpSide.SetSpecifics(padCMPSide, componentSide);
                cmpSide.FreeText = component.Ref;
                if (top)
                {
                    cmpSide.ObjectColorTemporary(Color.Silver);
                }
                else
                {
                    cmpSide.ObjectColorTemporary(Color.Gray);
                }
                #endregion
            }
        }
        private void fillNODDataList(IPCBIWindow parent, IStep step, IMatrix matrix, List <ICMPObject> lstAllCMPList, List <ThtPin> topTHTPinList, List <ThtPin> botTHTPinList, out List <string> dataList, List <INet> lstINetINetList, List <IODBObject> lstListOfAllDrillObjects, ref List <string> errorLogFile)
        {
            int inCounter4NONENetName = 0;

            dataList = new List <string>();
            string     strTopSigLay = matrix.GetTopSignalLayer();
            string     strBotSigLay = matrix.GetBotSignalLayer();
            IODBLayer  iodblayTopSig, iodblayBotSig, iodblayCurrSigLay;
            string     strPosition = string.Empty;
            string     strTecn     = string.Empty;
            string     strNetName  = string.Empty;
            string     strCmpRef   = string.Empty;
            string     strInfo     = string.Empty;
            ICMPObject iCmOCMPObject;
            char       chrWhiteSpa = ' ';
            int        minAbstand  = 15;
            int        maxAbstand  = 52;
            int        dist        = betterToRead;



            if (lstAllCMPList == null)
            {
                errorLogFile.Add("Method: fillNODDataList + lstAllCMPList is null");
                return;
            }


            // to get the maximum name length

            /*if (lstAllCMPList.Count > 0)
             * {
             *  foreach (ICMPObject cmp in lstAllCMPList)
             *  {
             *      if (cmp != null && !string.IsNullOrEmpty(cmp.PartName))
             *      {
             *          if (maxAbstand < cmp.PartName.Length)
             *          {
             *              maxAbstand = cmp.PartName.Length;
             *          }
             *      }
             *      else
             *      {
             *          errorLogFile.Add("Method: fillNODDataList + lstAllCMPList is null");
             *          return;
             *      }
             *  }
             * }
             * else
             * {
             *  MessageBox.Show("No componentens could be found");
             *  return;
             * }
             *
             *
             *
             * if (lstINetINetList.Count > 0)
             * {
             *  foreach (INet tempNet in lstINetINetList)
             *  {
             *      if (tempNet != null && !string.IsNullOrEmpty(tempNet.NetName))
             *      {
             *          if (maxAbstand < tempNet.NetName.Length)
             *          {
             *              maxAbstand = tempNet.NetName.Length;
             *          }
             *      }
             *      else
             *      {
             *          errorLogFile.Add("Method: fillNODDataList + lstINetInetList is null");
             *          return;
             *      }
             *  }
             * }
             * else
             * {
             *  MessageBox.Show("No componentens could be found");
             *  return;
             * }*/

            maxAbstand = maxAbstand + 2;


            if (!string.IsNullOrEmpty(strTopSigLay))
            {
                iodblayTopSig = (IODBLayer)step.GetLayer(strTopSigLay);
            }
            else
            {
                errorLogFile.Add("Method: fillNODDataList + strTopSigLay is null");
                iodblayTopSig = null;
            }

            if (!string.IsNullOrEmpty(strBotSigLay))
            {
                iodblayBotSig = (IODBLayer)step.GetLayer(strBotSigLay);
            }
            else
            {
                errorLogFile.Add("Method: fillNODDataList + strBotSigLay is null");
                iodblayBotSig = null;
            }

            dataList.Add("* " + "NetName".PadRight(minAbstand, chrWhiteSpa) + "CMP-Ref".PadRight(minAbstand, chrWhiteSpa) + "PinNr.".PadRight(minAbstand, chrWhiteSpa) + "X".PadRight(minAbstand, chrWhiteSpa) + "Y".PadRight(minAbstand, chrWhiteSpa) + "PadSize".PadRight(minAbstand, chrWhiteSpa) + "Pinposition".PadRight(minAbstand, chrWhiteSpa) + "CMP-Typ".PadRight(minAbstand, chrWhiteSpa) + "TEST".PadRight(minAbstand, chrWhiteSpa) + "CHANNEL".PadRight(minAbstand, chrWhiteSpa) + "USER");
            dataList.Add("* ");

            foreach (INet net in lstINetINetList)
            {
                if (net == null)
                {
                    errorLogFile.Add("Method: fillNODDataList + net is null");
                    return;
                }
                List <INetObject> lstNetComponentList = net.ComponentList;

                if (lstNetComponentList == null)
                {
                    errorLogFile.Add("Method: fillNODDataList + lstNetComponentList is null");
                    return;
                }
                foreach (INetObject inetObj in lstNetComponentList)
                {
                    iCmOCMPObject = inetObj.ICMP;
                    if (iCmOCMPObject == null)
                    {
                        errorLogFile.Add("Method: fillNODDataList + iCmOCMPObject is null");
                        continue;
                    }
                    strTecn = string.Empty;


                    bool boPinIsTopSoldered = true;
                    bool boPinIsPartOfTHT   = false;

                    if (!useTHTSearch)
                    {
                        boPinIsTopSoldered = iCmOCMPObject.PlacedTop;
                    }
                    else
                    {
                        if (iCmOCMPObject.PlacedTop)        // true is top layer
                        {
                            boPinIsTopSoldered = true;

                            foreach (var entry in topTHTPinList)
                            {
                                if (entry == null)
                                {
                                    errorLogFile.Add("Method: fillNODDataList + entry is null");
                                    return;
                                }
                                if (entry.Cmp.Ref == iCmOCMPObject.Ref)
                                {
                                    boPinIsPartOfTHT   = true;
                                    boPinIsTopSoldered = false;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            boPinIsTopSoldered = false;

                            foreach (var entry in botTHTPinList)
                            {
                                if (entry == null)
                                {
                                    errorLogFile.Add("Method: fillNODDataList + entry is null");
                                    return;
                                }
                                if (entry.Cmp.Ref == iCmOCMPObject.Ref)
                                {
                                    boPinIsPartOfTHT   = true;
                                    boPinIsTopSoldered = true;
                                    break;
                                }
                            }
                        }
                    }


                    if (boPinIsPartOfTHT == true)
                    {
                        strTecn = "T";
                    }
                    else
                    {
                        strTecn = "S";
                    }

                    if (boPinIsTopSoldered)
                    {
                        strPosition = "T";
                        if (iodblayTopSig != null)
                        {
                            iodblayCurrSigLay = iodblayTopSig;
                        }
                        else
                        {
                            errorLogFile.Add("Method: fillNODDataList + iodblayTopSig is null");
                            return;
                        }
                    }
                    else
                    {
                        strPosition = "B";
                        if (iodblayBotSig != null)
                        {
                            iodblayCurrSigLay = iodblayBotSig;
                        }
                        else
                        {
                            errorLogFile.Add("Method: fillNODDataList + iodblayBotSig is null");
                            return;
                        }
                    }

                    IPin pin = inetObj.GetIPin();
                    {
                        if (pin == null)
                        {
                            errorLogFile.Add("Method: fillNODDataList + pin is null");
                            continue;
                        }
                        IODBObject iodbobPinPad = null;
                        if (iodblayCurrSigLay != null)
                        {
                            iodbobPinPad = pin.GetIPinPad(iodblayCurrSigLay, iCmOCMPObject);
                        }

                        if (net.NetName == null)
                        {
                            errorLogFile.Add("Method: fillNODDataList + net.NetName is null");
                            return;
                        }
                        if (net.NetName == "$NONE$")
                        {
                            strNetName = '"' + net.NetName + inCounter4NONENetName.ToString(System.Globalization.CultureInfo.InvariantCulture) + '"';
                            inCounter4NONENetName++;
                        }
                        else
                        {
                            strNetName = '"' + net.NetName + '"';
                        }
                        strCmpRef = '"' + iCmOCMPObject.Ref + '"';

                        string strPadString = string.Empty;
                        double holeDiameter = 0;
                        bool   rotationExists = false;
                        bool   holeExists = false;
                        double doWidth = 0, doHeight = 0, doDegree = 0;


                        if (iodbobPinPad != null)
                        {
                            IObjectSpecificsD spec = iodbobPinPad.GetSpecificsD();
                            if (spec == null)
                            {
                                errorLogFile.Add("Method: fillNODDataList + spec is null");
                                return;
                            }

                            if (spec is IPadSpecificsD)
                            {
                                IPadSpecificsD pSpec = (IPadSpecificsD)spec;
                                //pSpec.ShapeIndex
                                if (pSpec == null)
                                {
                                    errorLogFile.Add("Method: fillNODDataList + pSpec is null");
                                    return;
                                }
                                IFilter filter = new IFilter(parent);

                                if (filter == null)
                                {
                                    errorLogFile.Add("Method: fillNODDataList + filter is null");
                                    return;
                                }

                                IFilter.ToolDefinition toolDef = filter.GetSymbolByShapeIndex(pSpec.ShapeIndex, iodblayCurrSigLay);
                                if (toolDef == null)
                                {
                                    errorLogFile.Add("Method: fillNODDataList + toolDef is null");
                                    return;
                                }

                                switch (toolDef.Type)
                                {
                                case PCBI.Symbol_Type.r:                //round

                                    foreach (IODBObject drill in lstListOfAllDrillObjects)
                                    {
                                        if (drill == null)
                                        {
                                            errorLogFile.Add("Method: fillNODDataList + drill is null");
                                            return;
                                        }
                                        if (drill.IsPointOfSecondObjectIncluded(iodbobPinPad))
                                        {
                                            holeExists   = true;
                                            holeDiameter = drill.GetDiameter();
                                        }
                                    }
                                    if (holeExists)
                                    {
                                        strPadString = "R" + Math.Round(toolDef.Diameter, 0).ToString(System.Globalization.CultureInfo.InvariantCulture) + "H" + Math.Round(holeDiameter, 0).ToString(System.Globalization.CultureInfo.InvariantCulture);
                                    }
                                    else
                                    {
                                        strPadString = "R" + Math.Round(toolDef.Diameter, 0).ToString(System.Globalization.CultureInfo.InvariantCulture);
                                    }
                                    break;

                                case PCBI.Symbol_Type.s:                // square
                                                                        //toolDef.Diameter;
                                    RectangleD bounds = iodbobPinPad.GetBoundsD();

                                    if (bounds == null)
                                    {
                                        errorLogFile.Add("Method: fillNODDataList + bounds are null");
                                        return;
                                    }

                                    if (pSpec.Rotation != 0)
                                    {
                                        IPolyClass padPoly = iodbobPinPad.GetPolygonOutline();
                                        if (padPoly == null)
                                        {
                                            errorLogFile.Add("Method: fillNODDataList + padPoly is null");
                                            return;
                                        }
                                        padPoly.Rotate(-pSpec.Rotation);
                                        padPoly.UpdateBounds();
                                        bounds = padPoly.GetBounds();
                                    }
                                    strPadString = "X" + Math.Round(bounds.Height, 0).ToString(System.Globalization.CultureInfo.InvariantCulture);
                                    break;

                                case PCBI.Symbol_Type.rect:
                                default:
                                    RectangleD rectBounds = iodbobPinPad.GetBoundsD();
                                    if (rectBounds == null)
                                    {
                                        errorLogFile.Add("Method: fillNODDataList + bounds are null");
                                        return;
                                    }

                                    if (pSpec.Rotation != 0)
                                    {
                                        doDegree       = pSpec.Rotation;
                                        rotationExists = true;
                                        IPolyClass padPoly = iodbobPinPad.GetPolygonOutline();
                                        if (padPoly == null)
                                        {
                                            errorLogFile.Add("Method: fillNODDataList + padPoly is null");
                                            return;
                                        }
                                        padPoly.Rotate(-pSpec.Rotation);
                                        padPoly.UpdateBounds();
                                        rectBounds = padPoly.GetBounds();
                                    }
                                    doWidth  = rectBounds.Width;
                                    doHeight = rectBounds.Height;

                                    if (rotationExists)
                                    {
                                        strPadString = "X" + Math.Round(doWidth, 0).ToString(System.Globalization.CultureInfo.InvariantCulture) + "Y" + Math.Round(doHeight, 0).ToString(System.Globalization.CultureInfo.InvariantCulture) + "A" + Math.Round(doDegree, 0).ToString(System.Globalization.CultureInfo.InvariantCulture);
                                    }
                                    else
                                    {
                                        foreach (IODBObject drill in lstListOfAllDrillObjects)
                                        {
                                            if (drill == null)
                                            {
                                                errorLogFile.Add("Method: fillNODDataList + drill is null");
                                                return;
                                            }
                                            if (drill.IsPointOfSecondObjectIncluded(iodbobPinPad))
                                            {
                                                holeExists   = true;
                                                holeDiameter = drill.GetDiameter();
                                            }
                                        }
                                        if (holeExists)
                                        {
                                            strPadString = "X" + Math.Round(doWidth, 0).ToString(System.Globalization.CultureInfo.InvariantCulture) + "Y" + Math.Round(doHeight, 0).ToString(System.Globalization.CultureInfo.InvariantCulture) + "H" + Math.Round(holeDiameter, 0).ToString(System.Globalization.CultureInfo.InvariantCulture);
                                        }
                                        else
                                        {
                                            strPadString = "X" + Math.Round(doWidth, 0).ToString(System.Globalization.CultureInfo.InvariantCulture) + "Y" + Math.Round(doHeight, 0).ToString(System.Globalization.CultureInfo.InvariantCulture);
                                        }
                                    }


                                    break;
                                }
                            }
                        }
                        else
                        {
                            strPadString = "0";
                            errorLogFile.Add("Method: fillNODDataList + iodbobPinPad is null");
                            return;
                        }
                        string strXValue = (Math.Round(IMath.Mils2MM(pin.GetIPinPositionD(iCmOCMPObject).X), digits)).ToString(System.Globalization.CultureInfo.InvariantCulture);
                        string strYValue = (Math.Round(IMath.Mils2MM(pin.GetIPinPositionD(iCmOCMPObject).Y), digits)).ToString(System.Globalization.CultureInfo.InvariantCulture);



                        strInfo = string.Concat(strNetName.PadRight(strNetName.Length + dist, chrWhiteSpa),
                                                strCmpRef.PadRight(strCmpRef.Length + dist, chrWhiteSpa),
                                                pin.PinNumber.PadRight(pin.PinNumber.Length + dist, chrWhiteSpa),
                                                strXValue.PadRight(strXValue.Length + dist, chrWhiteSpa),
                                                strYValue.PadRight(strYValue.Length + dist, chrWhiteSpa),
                                                strPadString.PadRight(strPadString.Length + dist, chrWhiteSpa),
                                                strPosition.PadRight(strPosition.Length + dist, chrWhiteSpa),
                                                strTecn.PadRight(strTecn.Length + dist, chrWhiteSpa),
                                                "Y".PadRight(2, chrWhiteSpa),
                                                "0".PadRight(2, chrWhiteSpa), " ");

                        if (!dataList.Contains(strInfo))
                        {
                            dataList.Add(strInfo);
                        }
                    }
                }
            }
        }
        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();
        }