static void Main(string[] args) { if (args.Count() < 1) { Console.WriteLine("Usage: DirtyPCB_BoardStats.exe <infile>|<infolder>|<inzip>"); return; } Stats TheStats = new Stats(); if (Directory.Exists(args[0])) { GerberLibrary.GerberImageCreator GIC = new GerberLibrary.GerberImageCreator(); foreach (var L in Directory.GetFiles(args[0]).ToList()) { TheStats.AddFile(new GerberLibrary.StandardConsoleLog(), L); } } else if (File.Exists(args[0])) { if (Path.GetExtension(args[0]).ToLower() == ".zip") { using (ZipFile zip1 = ZipFile.Read(args[0])) { foreach (ZipEntry e in zip1) { MemoryStream MS = new MemoryStream(); if (e.IsDirectory == false) { e.Extract(MS); MS.Seek(0, SeekOrigin.Begin); TheStats.AddFile(new GerberLibrary.StandardConsoleLog(), MS, e.FileName); } } } } else { TheStats.AddFile(new GerberLibrary.StandardConsoleLog(), args[0]); } } TheStats.Complete(); var json = new JavaScriptSerializer().Serialize(TheStats); Console.WriteLine(json); }
private static void RunImageGeneration() { try { var InputFiles = Directory.GetFiles(TheSettings.InputFolder); GerberImageCreator GIC = new GerberLibrary.GerberImageCreator(); GerberImageCreator.AA = true; BoardRenderColorSet Colors = new BoardRenderColorSet(); Colors.BoardRenderColor = TheSettings.SolderMaskColor; Colors.BoardRenderTraceColor = TheSettings.SolderMaskColor; if (TheSettings.HasTraceColor) { Colors.BoardRenderTraceColor = TheSettings.TraceColor; } Colors.BoardRenderSilkColor = TheSettings.SilkScreenColor; Colors.BoardRenderPadColor = TheSettings.CopperColor; GIC.AddBoardsToSet(InputFiles.ToList()); GIC.SetColors(Colors); if (GIC.Errors.Count > 0) { foreach (var a in GIC.Errors) { Console.WriteLine("Error: {0}", a); } // return; } // Console.WriteLine("Progress: Estimated board bounding box:{0:N2},{1:N2} - {2:N2},{3:N2} -> {4:N2},{5:N2}", GIC.BoundingBox.TopLeft.X, GIC.BoundingBox.TopLeft.Y, GIC.BoundingBox.BottomRight.X, GIC.BoundingBox.BottomRight.Y, GIC.BoundingBox.Width(), GIC.BoundingBox.Height()); // Gerber.SaveIntermediateImages = true; Console.WriteLine("Progress: Rendering Top"); GIC.DrawToFile(TheSettings.OutputFolder + "/FullRender", BoardSide.Top, 200, false); Console.WriteLine("Progress: Rendering Bottom"); GIC.DrawToFile(TheSettings.OutputFolder + "/FullRender", BoardSide.Bottom, 200, false); GIC.DrawAllFiles(TheSettings.OutputFolder + "/Layer", 200, new DirtyPCB_BoardRender()); Console.WriteLine("Progress: Done!"); } catch (Exception E) { if (TheSettings.TimeOutExpired == false) { Console.WriteLine("Error: {0}", E.Message); } } }
static void Main(string[] args) { // Gerber.ShowProgress = true; GerberNumberFormat GNF = new GerberNumberFormat(); GNF.DigitsAfter = 3; GNF.DigitsBefore = 3; GNF.SetMetricMode(); // GerberSplitter GS = new GerberSplitter(); // GS.Split("X-1.15Y-1.9", GNF, true); //foreach(var a in GS.Pairs)// // { // Console.WriteLine("{0}:{1} {2}", a.Key, a.Value.Command, a.Value.Number); // } // Console.ReadKey(); if (args.Count() == 0) { Console.WriteLine("Usage:"); Console.WriteLine("GerberAnalyse <inputfile>");// <-forcezerowidth> <-dim>"); return; } /* * ParsedGerber PLS; * bool forcezerowidth = false; * bool compact = false; * * for (int i = 1; i < args.Count(); i++) * { * if (args[i] == "-forcezerowidth") forcezerowidth = true; * if (args[i] == "-dim") compact = true; * } * * if (Gerber.FindFileType(args[0].ToLower()) == BoardFileType.Drill) * { * PLS = PolyLineSet.LoadExcellonDrillFile(args[0]); * // ExcellonFile EF = new ExcellonFile(); * // EF.Load(a); * } * else * { * // PLS.PreCombinePolygons = false; * // forcezerowidth = true; * PLS = PolyLineSet.LoadGerberFile(args[0], forcezerowidth, false, new GerberParserState() { PreCombinePolygons = false}); * } * * PLS.CalcPathBounds(); * * if (compact) { * * CultureInfo CI = CultureInfo.InvariantCulture; * * Console.WriteLine("{0}x{1}(mm)", (PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X).ToString("N3", CI), (PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y).ToString("N3", CI)); * Console.WriteLine("{0}x{1}(imp)", ((PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X) / 25.4).ToString("N3", CI), ((PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y) / 25.4).ToString("N3", CI)); * } * else * { * Console.WriteLine("Report for {0}:", args[0]); * Console.WriteLine("Suspected file side: {0}, layertype: {1}", PLS.Side.ToString(), PLS.Layer.ToString()); * Console.WriteLine("DisplayShape #: {0}", PLS.DisplayShapes.Count); * foreach (var o in PLS.DisplayShapes) * { * Console.WriteLine("\tOutline {0} vertices thin:{1}", o.Vertices.Count, o.Thin); * foreach (var v in o.Vertices) * { * Console.WriteLine("\t\t{0}", v); * } * * } * * Console.WriteLine("OutlineShape #: {0}", PLS.OutlineShapes.Count); * foreach (var o in PLS.OutlineShapes) * { * Console.WriteLine("\tOutline {0} vertices thin:{1}", o.Vertices.Count, o.Thin); * foreach (var v in o.Vertices) * { * Console.WriteLine("\t\t{0}", v); * } * } * Console.WriteLine("Aperture #: {0}", PLS.State.Apertures.Count); * foreach (var apt in PLS.State.Apertures) * { * Console.Write("\tAperture D{0} ", apt.Key.ToString("D2")); * Console.Write("type: {0} ", apt.Value.ShapeType.ToString()); * switch (apt.Value.ShapeType) * { * case GerberApertureShape.Circle: * * Console.Write("diameter {0} ", apt.Value.CircleRadius * 2); break; * } * Console.WriteLine(); * } * Console.WriteLine("Corners: "); * Console.WriteLine(PLS.BoundingBox.TopLeft); * Console.WriteLine(PLS.BoundingBox.BottomRight); * Console.WriteLine("Size: {0}x{1} mm", PLS.BoundingBox.BottomRight.X - PLS.BoundingBox.TopLeft.X, PLS.BoundingBox.BottomRight.Y - PLS.BoundingBox.TopLeft.Y); * } */ Stats TheStats = new Stats(); if (Directory.Exists(args[0])) { GerberLibrary.GerberImageCreator GIC = new GerberLibrary.GerberImageCreator(); foreach (var L in Directory.GetFiles(args[0]).ToList()) { TheStats.AddFile(L); } } else if (File.Exists(args[0])) { if (Path.GetExtension(args[0]).ToLower() == ".zip") { using (ZipFile zip1 = ZipFile.Read(args[0])) { foreach (ZipEntry e in zip1) { if (e.IsDirectory == false) { MemoryStream MS = new MemoryStream(); e.Extract(MS); MS.Seek(0, SeekOrigin.Begin); TheStats.AddFile(MS, e.FileName); } } } } else { TheStats.AddFile(args[0]); } } TheStats.Complete(); Console.WriteLine("Corners: "); Console.WriteLine(TheStats.Box.TopLeft); Console.WriteLine(TheStats.Box.BottomRight); Console.WriteLine("Size: {0}x{1} mm", TheStats.Width, TheStats.Height); //var json = new JavaScriptSerializer().Serialize(TheStats); //Console.WriteLine(json); // Console.WriteLine("Press any key to continue"); // Console.ReadKey(); }
internal void Load(string basefile) { Text = Path.GetFileNameWithoutExtension(basefile); string fn = Path.GetFileName(basefile); string basefolder = Path.GetDirectoryName(basefile); string name = fn.Split('_')[0]; string BOMFile = ""; string PnPFile = ""; string gerberFile = ""; var L = Directory.GetFiles(basefolder, name + "_*.*"); SolderFile = ""; foreach (var file in L) { if (file.EndsWith("_BOM.csv")) { BOMFile = file; } if (file.EndsWith("_gerbers.zip")) { gerberFile = file; } if (file.EndsWith("_PNP.csv")) { PnPFile = file; } if (file.EndsWith("_soldered.txt")) { SolderFile = file; } } LayerSets.Add(new LayerSet() { Side = BoardSide.Both, Layer = BoardLayer.Outline }); LayerSets.Add(new LayerSet() { Side = BoardSide.Top, Layer = BoardLayer.SolderMask }); LayerSets.Add(new LayerSet() { Side = BoardSide.Top, Layer = BoardLayer.Silk }); LayerSets.Add(new LayerSet() { Side = BoardSide.Bottom, Layer = BoardLayer.SolderMask }); LayerSets.Add(new LayerSet() { Side = BoardSide.Bottom, Layer = BoardLayer.Silk }); if (BOMFile.Length > 0 && PnPFile.Length > 0 && gerberFile.Length > 0) { BOM B = new BOM(); B.LoadJLC(BOMFile, PnPFile); TheBOM = B; if (SolderFile.Length > 0) { solderedlist = File.ReadAllLines(SolderFile).ToList(); foreach (var a in B.DeviceTree) { foreach (var v in a.Value.Values) { if (solderedlist.Contains(v.Combined())) { v.Soldered = true; } } } } else { SolderFile = Path.Combine(basefolder, name + "_soldered.txt"); SaveSolderedList(); } GerberLibrary.GerberImageCreator GIC = new GerberLibrary.GerberImageCreator(); List <string> res = new List <string>(); Dictionary <string, MemoryStream> Files = new Dictionary <string, MemoryStream>(); using (Ionic.Zip.ZipFile zip1 = Ionic.Zip.ZipFile.Read(gerberFile)) { foreach (ZipEntry e in zip1) { MemoryStream MS = new MemoryStream(); if (e.IsDirectory == false) { e.Extract(MS); MS.Seek(0, SeekOrigin.Begin); Files[e.FileName] = MS; } } } string[] FileNames = Files.Keys.ToArray(); List <string> outlinefiles = new List <string>(); List <string> topsilkfiles = new List <string>(); List <string> bottomsilkfiles = new List <string>(); foreach (var F in FileNames) { BoardSide BS = BoardSide.Unknown; BoardLayer BL = BoardLayer.Unknown; Files[F].Seek(0, SeekOrigin.Begin); if (Gerber.FindFileTypeFromStream(new StreamReader(Files[F]), F) == BoardFileType.Gerber) { Gerber.DetermineBoardSideAndLayer(F, out BS, out BL); foreach (var l in LayerSets) { if (l.Side == BS && l.Layer == BL) { l.Files.Add(F); Files[F].Seek(0, SeekOrigin.Begin); var pls = PolyLineSet.LoadGerberFileFromStream(new StandardConsoleLog(), new StreamReader(Files[F]), F, true, false, new GerberParserState() { PreCombinePolygons = false }); l.Gerbs.Add(pls); } } } } TheBox.Reset(); foreach (var a in LayerSets[0].Gerbs) { TheBox.AddBox(a.BoundingBox); } } }
private void VScore_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] D = e.Data.GetData(DataFormats.FileDrop) as string[]; BackColor = Color.Green; foreach (string S in D) { if (Directory.Exists(S)) { try { GerberLibrary.GerberImageCreator GIC = new GerberLibrary.GerberImageCreator(); var A = Directory.GetFiles(S); GIC.AddBoardsToSet(A.ToList(), new StandardConsoleLog()); GerberFrameWriter.FrameSettings FS = new GerberFrameWriter.FrameSettings(); List <String> OutputLines = new List <string>(); OutputLines.Add(String.Format("Panel for {0}", Path.GetDirectoryName(S))); Bounds PanelBounds = new Bounds(); double w = GIC.BoundingBox.Width(); double h = GIC.BoundingBox.Height(); double bx = GIC.BoundingBox.TopLeft.X; double by = GIC.BoundingBox.TopLeft.Y; GerberPanel Pnl = new GerberPanel(); Pnl.TheSet.ClipToOutlines = false; Pnl.AddGerberFolder(new StandardConsoleLog(), S); double ginbetween = (double)numericUpDown1.Value; for (int x = 0; x < (int)xbox.Value; x++) { for (int y = 0; y < (int)ybox.Value; y++) { var I = Pnl.AddInstance(S, new PointD(x * (w + ginbetween), y * (h + ginbetween))); OutputLines.Add(String.Format("Adding board instance: {0}mm x {1}mm offset", x * (w + ginbetween), y * (h + ginbetween))); if (theMode == PanelMode.Groovy) { I.IgnoreOutline = true; } PanelBounds.FitPoint(bx + ((x + 0) * (w + ginbetween)), by + ((y + 0) * (h + ginbetween))); PanelBounds.FitPoint(bx + (w + (x + 0) * (w + ginbetween)), by + ((y + 0) * (h + ginbetween))); PanelBounds.FitPoint(bx + (w + (x + 0) * (w + ginbetween)), by + (h + (y + 0) * (h + ginbetween))); PanelBounds.FitPoint(bx + ((x + 0) * (w + ginbetween)), by + (h + (y + 0) * (h + ginbetween))); } } if (theMode == PanelMode.Tabby) { OutputLines.Add("Panel created as Tabby board"); OutputLines.Add(String.Format("Space inbetween: {0}mm", ginbetween)); FS.FrameTitle = FrameTitle.Text;; FS.RenderSample = false; FS.margin = ginbetween; FS.topEdge = FS.leftEdge = (double)framebox.Value; OutputLines.Add(String.Format("Frame width: {0}mm", FS.leftEdge)); FS.roundedInnerCorners = 0; FS.roundedOuterCorners = 0; FS.RenderSample = false; FS.DirectionArrowSide = GerberLibrary.Core.BoardSide.Top; FS.RenderDirectionArrow = true; //FS.DefaultFiducials = true; //FS.FiducialSide = BoardSide.Both; FS.HorizontalTabs = false; FS.VerticalTabs = false; FS.InsideEdgeMode = GerberFrameWriter.FrameSettings.InsideMode.RegularEdge; FS.PositionAround(PanelBounds); string sS = String.Format("Frame size: {0} mm x {1} mm", FS.innerWidth + FS.margin * 2 + FS.leftEdge, FS.innerHeight + FS.margin * 2 + FS.topEdge); OutputLines.Add(sS); var OutputFolder = Path.Combine(S, "../" + Path.GetFileNameWithoutExtension(S) + "_TABBY"); Directory.CreateDirectory(OutputFolder); String FrameFolder = Path.Combine(OutputFolder, "frame"); Directory.CreateDirectory(FrameFolder); //Directory.CreateDirectory(Path.Combine(OutputFolder, "merged")); Directory.CreateDirectory(Path.Combine(OutputFolder, "merged")); GerberFrameWriter.WriteSideEdgeFrame(null, FS, Path.Combine(FrameFolder, "panelframe"), null); Pnl.AddGerberFolder(new StandardConsoleLog(), FrameFolder); Pnl.AddInstance(FrameFolder, new PointD(0, 0)); Pnl.TheSet.MergeFileTypes = false; int tabcount = 2; double tx = (w - (tabcount * ginbetween * 2)) / (tabcount + 1.0f); double ty = (h - (tabcount * ginbetween * 2)) / (tabcount + 1.0f); double txs = tx + ginbetween; double tys = ty + ginbetween; tx += ginbetween * 2; ty += ginbetween * 2; for (int x = 0; x < (int)xbox.Value + 1; x++) { for (int y = 0; y < (int)ybox.Value + 1; y++) { for (int i = 0; i < tabcount; i++) { if (x < (int)xbox.Value) { var BT1 = Pnl.AddTab(new PointD(bx + (x + 0) * (w + ginbetween) + tx * (i) + txs, by + ((y + 0) * (h + ginbetween)) - ginbetween / 2)); BT1.Radius = (float)ginbetween; } if (y < (int)ybox.Value) { var BT2 = Pnl.AddTab(new PointD(bx + (x + 0) * (w + ginbetween) - ginbetween / 2, by + ((y + 0) * (h + ginbetween)) + ty * (i) + tys)); BT2.Radius = (float)ginbetween; } } } } Pnl.UpdateShape(new StandardConsoleLog()); Pnl.SaveGerbersToFolder(Path.GetFileNameWithoutExtension(S) + "_Panel", Path.Combine(OutputFolder, "merged"), new StandardConsoleLog()); File.WriteAllLines(Path.Combine(OutputFolder, "PanelReport.txt"), OutputLines); List <String> FilesInFolder = Directory.GetFiles(Path.Combine(OutputFolder, "merged"), "*.frontpanelholes").ToList(); if (FilesInFolder.Count > 0) { String JigFolder = Path.Combine(OutputFolder, "jig"); Directory.CreateDirectory(JigFolder); File.Copy(FilesInFolder[0], Path.Combine(JigFolder, "jig.gml"), true); FS.InsideEdgeMode = GerberFrameWriter.FrameSettings.InsideMode.NoEdge; GerberFrameWriter.WriteSideEdgeFrame(null, FS, Path.Combine(JigFolder, "jig"), null); GerberMerger.Merge(Path.Combine(JigFolder, "jig.gml"), Path.Combine(JigFolder, "jig.gko"), Path.Combine(JigFolder, "jig.gko2"), new StandardConsoleLog()); File.Delete(Path.Combine(JigFolder, "jig.gko")); File.Delete(Path.Combine(JigFolder, "jig.gml")); File.Move(Path.Combine(JigFolder, "jig.gko2"), Path.Combine(JigFolder, "jig.gko")); } } if (theMode == PanelMode.Groovy) { FS.FrameTitle = FrameTitle.Text;; FS.RenderSample = false; FS.margin = 0; FS.topEdge = FS.leftEdge = (double)framebox.Value; FS.roundedInnerCorners = 0; FS.roundedOuterCorners = 0; FS.RenderSample = false; FS.RenderDirectionArrow = false; FS.DirectionArrowSide = GerberLibrary.Core.BoardSide.Top; //FS.DefaultFiducials = true; //FS.FiducialSide = BoardSide.Both; FS.HorizontalTabs = false; FS.VerticalTabs = false; FS.InsideEdgeMode = GerberFrameWriter.FrameSettings.InsideMode.NoEdge; FS.PositionAround(PanelBounds); var OutputFolder = Path.Combine(S, "../" + Path.GetFileNameWithoutExtension(S) + "_GROOVY"); Directory.CreateDirectory(OutputFolder); GerberOutlineWriter GOW = new GerberOutlineWriter(); int xmax = (int)xbox.Value + 1; int ymax = (int)ybox.Value + 1; if (ginbetween > 0) { xmax--; ymax--; } for (int x = 0; x < xmax; x++) { PolyLine PL = new PolyLine(); PL.Add(bx + (x) * (w + ginbetween), PanelBounds.TopLeft.Y - (float)framebox.Value - 10); PL.Add(bx + (x) * (w + ginbetween), PanelBounds.BottomRight.Y + (float)framebox.Value + 10); GOW.AddPolyLine(PL); if (ginbetween > 0) { PolyLine PL2 = new PolyLine(); PL2.Add(bx + (x) * (w + ginbetween) + w, PanelBounds.TopLeft.Y - (float)framebox.Value - 10); PL2.Add(bx + (x) * (w + ginbetween) + w, PanelBounds.BottomRight.Y + (float)framebox.Value + 10); GOW.AddPolyLine(PL2); } } for (int y = 0; y < ymax; y++) { PolyLine PL = new PolyLine(); PL.Add(PanelBounds.TopLeft.X - (float)framebox.Value - 10, by + (y) * (h + ginbetween)); PL.Add(PanelBounds.BottomRight.X + (float)framebox.Value + 10, by + (y) * (h + ginbetween)); GOW.AddPolyLine(PL); if (ginbetween > 0) { PolyLine PL2 = new PolyLine(); PL2.Add(PanelBounds.TopLeft.X - (float)framebox.Value - 10, by + (y) * (h + ginbetween) + h); PL2.Add(PanelBounds.BottomRight.X + (float)framebox.Value + 10, by + (y) * (h + ginbetween) + h); GOW.AddPolyLine(PL2); } } GOW.Write(Path.Combine(OutputFolder, "VGrooves.gbr")); String FrameFolder = Path.Combine(OutputFolder, "frame"); Directory.CreateDirectory(FrameFolder); Directory.CreateDirectory(Path.Combine(OutputFolder, "merged")); GerberFrameWriter.WriteSideEdgeFrame(null, FS, Path.Combine(FrameFolder, "panelframe"), null); Pnl.AddGerberFolder(new StandardConsoleLog(), FrameFolder); Pnl.AddInstance(FrameFolder, new PointD(0, 0)); Pnl.UpdateShape(new StandardConsoleLog()); Pnl.SaveGerbersToFolder(Path.GetFileNameWithoutExtension(S) + "_Panel", Path.Combine(OutputFolder, "merged"), new StandardConsoleLog()); } CountDown = 10; } catch (Exception) { BackColor = Color.Red; } } } } }
private void VScore_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] D = e.Data.GetData(DataFormats.FileDrop) as string[]; BackColor = Color.Green; foreach (string S in D) { if (Directory.Exists(S)) { try { var OutputFolder = Path.Combine(S, "../" + Path.GetFileNameWithoutExtension(S) + "_GROOVY"); Directory.CreateDirectory(OutputFolder); GerberLibrary.GerberImageCreator GIC = new GerberLibrary.GerberImageCreator(); var A = Directory.GetFiles(S); GIC.AddBoardsToSet(A.ToList(), new StandardConsoleLog()); GerberFrameWriter.FrameSettings FS = new GerberFrameWriter.FrameSettings(); FS.FrameTitle = FrameTitle.Text;; FS.RenderSample = false; FS.margin = 0; FS.topEdge = FS.leftEdge = (double)framebox.Value; FS.roundedInnerCorners = 0; FS.roundedOuterCorners = 0; FS.RenderSample = false; FS.RenderDirectionArrow = false; FS.DirectionArrowSide = GerberLibrary.Core.BoardSide.Top; //FS.DefaultFiducials = true; //FS.FiducialSide = BoardSide.Both; FS.HorizontalTabs = false; FS.VerticalTabs = false; FS.InsideEdgeMode = GerberFrameWriter.FrameSettings.InsideMode.NoEdge; Bounds PanelBounds = new Bounds(); double w = GIC.BoundingBox.Width(); double h = GIC.BoundingBox.Height(); double bx = GIC.BoundingBox.TopLeft.X; double by = GIC.BoundingBox.TopLeft.Y; GerberPanel Pnl = new GerberPanel(); Pnl.TheSet.ClipToOutlines = false; Pnl.AddGerberFolder(new StandardConsoleLog(), S); for (int x = 0; x < (int)xbox.Value; x++) { for (int y = 0; y < (int)ybox.Value; y++) { var I = Pnl.AddInstance(S, new PointD(x * w, y * h)); I.IgnoreOutline = true; PanelBounds.FitPoint(bx + ((x + 0) * w), by + ((y + 0) * h)); PanelBounds.FitPoint(bx + ((x + 1) * w), by + ((y + 0) * h)); PanelBounds.FitPoint(bx + ((x + 1) * w), by + ((y + 1) * h)); PanelBounds.FitPoint(bx + ((x + 0) * w), by + ((y + 1) * h)); } } FS.PositionAround(PanelBounds); GerberOutlineWriter GOW = new GerberOutlineWriter(); for (int x = 0; x < (int)xbox.Value + 1; x++) { PolyLine PL = new PolyLine(); PL.Add(bx + (x) * w, PanelBounds.TopLeft.Y - (float)framebox.Value - 10); PL.Add(bx + (x) * w, PanelBounds.BottomRight.Y + (float)framebox.Value + 10); GOW.AddPolyLine(PL); } for (int y = 0; y < (int)ybox.Value + 1; y++) { PolyLine PL = new PolyLine(); PL.Add(PanelBounds.TopLeft.X - (float)framebox.Value - 10, by + (y) * h); PL.Add(PanelBounds.BottomRight.X + (float)framebox.Value + 10, by + (y) * h); GOW.AddPolyLine(PL); } GOW.Write(Path.Combine(OutputFolder, "VGrooves.gbr")); String FrameFolder = Path.Combine(OutputFolder, "frame"); Directory.CreateDirectory(FrameFolder); Directory.CreateDirectory(Path.Combine(OutputFolder, "merged")); GerberFrameWriter.WriteSideEdgeFrame(null, FS, Path.Combine(FrameFolder, "panelframe"), null); Pnl.AddGerberFolder(new StandardConsoleLog(), FrameFolder); Pnl.AddInstance(FrameFolder, new PointD(0, 0)); Pnl.UpdateShape(new StandardConsoleLog()); Pnl.SaveGerbersToFolder(Path.GetFileNameWithoutExtension(S) + "_Panel", Path.Combine(OutputFolder, "merged"), new StandardConsoleLog()); CountDown = 10; } catch (Exception) { BackColor = Color.Red; } } } } }