Exemple #1
0
        private void LoadUltiboard(string bOMFile, string centroids)
        {
            Dictionary <string, BOMEntry.RefDesc> positions = new Dictionary <string, BOMEntry.RefDesc>();



            CSVLoader centroidloader = new CSVLoader();

            centroidloader.LoadFile(centroids);


            int FirstRow = -1;

            for (int i = 0; i < centroidloader.Lines.Count; i++)
            {
                if (centroidloader.Lines[i].columns[0] == "REFDES")
                {
                    FirstRow = i + 1;
                }
            }

            if (FirstRow > -1)
            {
                for (int i = FirstRow; i < centroidloader.Lines.Count; i++)
                {
                    var    Line = centroidloader.Lines[i];
                    string rd = Line.columns[0];
                    double X = 0, Y = 0, Angle = 0;

                    X     = Double.Parse(Line.columns[3]) / 1000000.0;
                    Y     = Double.Parse(Line.columns[4]) / 1000000.0;
                    Angle = Double.Parse(Line.columns[5]);

                    BoardSide Side = BoardSide.Top;
                    if (Line.columns[6] != "TOP")
                    {
                        Side = BoardSide.Bottom;
                    }

                    positions[rd] = new BOMEntry.RefDesc()
                    {
                        angle = Angle, x = X, y = Y, OriginalName = rd, NameOnBoard = rd, SourceBoard = bOMFile, Side = Side
                    };
                }
            }


            BOMNumberSet Set       = new BOMNumberSet();
            CSVLoader    bomloader = new CSVLoader();

            bomloader.LoadFile(bOMFile);

            FirstRow = -1;
            for (int i = 0; i < bomloader.Lines.Count; i++)
            {
                if (bomloader.Lines[i].columns[0] == "VALUE")
                {
                    FirstRow = i + 1;
                }
            }

            if (FirstRow > -1)
            {
                for (int i = FirstRow; i < bomloader.Lines.Count; i++)
                {
                    string value   = bomloader.Lines[i].columns[0];
                    string package = bomloader.Lines[i].columns[1];
                    var    refdes  = bomloader.Lines[i].columns[3].Split(',');
                    foreach (var rd in refdes)
                    {
                        var S = positions[rd];

                        AddBOMItem(package, "", value, rd, Set, bOMFile, S.x, S.y, S.angle, S.Side);
                    }
                }
            }
        }