Example #1
0
            public void AddFile(MemoryStream L, string filename)
            {
                L.Seek(0, SeekOrigin.Begin);

                var T = GerberLibrary.Gerber.FindFileTypeFromStream(new StreamReader(L), filename);

                switch (T)
                {
                case GerberLibrary.Core.BoardFileType.Drill:
                {
                    GerberLibrary.ExcellonFile EF = new GerberLibrary.ExcellonFile();
                    L.Seek(0, SeekOrigin.Begin);

                    EF.Load(new StreamReader(L));
                    DrillCount += EF.TotalDrillCount();
                }
                break;

                case GerberLibrary.Core.BoardFileType.Gerber:
                {
                    GerberLibrary.Core.BoardSide  Side;
                    GerberLibrary.Core.BoardLayer Layer;
                    GerberLibrary.Gerber.DetermineBoardSideAndLayer(filename, out Side, out Layer);
                    if (Layer == GerberLibrary.Core.BoardLayer.Outline || Layer == GerberLibrary.Core.BoardLayer.Mill)
                    {
                        L.Seek(0, SeekOrigin.Begin);
                        var G = GerberLibrary.PolyLineSet.LoadGerberFileFromStream(new StreamReader(L), filename);
                        Box.AddBox(G.BoundingBox);
                    }
                }
                break;
                }
            }
Example #2
0
            public void AddFile(string L)
            {
                var T = GerberLibrary.Gerber.FindFileType(L);

                switch (T)
                {
                case GerberLibrary.Core.BoardFileType.Drill:
                {
                    GerberLibrary.ExcellonFile EF = new GerberLibrary.ExcellonFile();
                    EF.Load(L);
                    DrillCount += EF.TotalDrillCount();
                }
                break;

                case GerberLibrary.Core.BoardFileType.Gerber:
                {
                    GerberLibrary.Core.BoardSide  Side;
                    GerberLibrary.Core.BoardLayer Layer;
                    GerberLibrary.Gerber.DetermineBoardSideAndLayer(L, out Side, out Layer);
                    if (Layer == GerberLibrary.Core.BoardLayer.Outline || Layer == GerberLibrary.Core.BoardLayer.Mill)
                    {
                        var G = GerberLibrary.PolyLineSet.LoadGerberFile(L);
                        Box.AddBox(G.BoundingBox);
                    }
                }
                break;
                }
            }