Skip to content

Commit 5b08cba

Browse files
committed
Better Log Stack - framecreator - better pcb writer - makeicon etcetc
1 parent d2cc445 commit 5b08cba

36 files changed

Lines changed: 1112 additions & 625 deletions

AutoPanelBuilder/AutoPanelBuilder.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using GerberLibrary.Core.Primitives;
1+
using GerberLibrary;
2+
using GerberLibrary.Core.Primitives;
23
using System;
34
using System.Collections.Generic;
45
using System.IO;
@@ -103,7 +104,7 @@ static void Main(string[] args)
103104
{
104105
foreach (var a in File.ReadAllLines(InputFile))
105106
{
106-
var A = GP.AddGerberFolder(a);
107+
var A = GP.AddGerberFolder(new StandardConsoleLog(), a);
107108
GP.AddInstance(a, new GerberLibrary.Core.Primitives.PointD(0, 0));
108109
}
109110
}
@@ -122,7 +123,7 @@ static void Main(string[] args)
122123
GerberLibrary.GerberArtWriter GAW2 = new GerberLibrary.GerberArtWriter();
123124
GerberLibrary.GerberArtWriter GAW = new GerberLibrary.GerberArtWriter();
124125

125-
GP.BuildAutoTabs(GAW, GAW2);
126+
GP.BuildAutoTabs(new StandardConsoleLog(), GAW, GAW2);
126127

127128

128129
string basepath = args[args.Count() - 1];

DirtyPCBs/DirtyPCB_BoardStats/DirtyPCB_BoardStats.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.IO;
77
using Ionic.Zip;
88
using System.Web.Script.Serialization;
9+
using GerberLibrary;
910

1011
namespace DirtyPCB_BoardStats
1112
{
@@ -95,7 +96,7 @@ public void AddFile(GerberLibrary.ProgressLog log, MemoryStream L, string filena
9596
if (Layer == GerberLibrary.Core.BoardLayer.Outline || Layer == GerberLibrary.Core.BoardLayer.Mill)
9697
{
9798
L.Seek(0, SeekOrigin.Begin);
98-
var G = GerberLibrary.PolyLineSet.LoadGerberFileFromStream(new StreamReader(L), filename);
99+
var G = GerberLibrary.PolyLineSet.LoadGerberFileFromStream(new StandardConsoleLog(), new StreamReader(L), filename);
99100
Box.AddBox(G.BoundingBox);
100101
}
101102
}
@@ -124,7 +125,7 @@ public void AddFile(GerberLibrary.ProgressLog log, string L)
124125
GerberLibrary.Gerber.DetermineBoardSideAndLayer(L, out Side, out Layer);
125126
if (Layer == GerberLibrary.Core.BoardLayer.Outline || Layer == GerberLibrary.Core.BoardLayer.Mill)
126127
{
127-
var G = GerberLibrary.PolyLineSet.LoadGerberFile(L);
128+
var G = GerberLibrary.PolyLineSet.LoadGerberFile(log, L);
128129
Box.AddBox(G.BoundingBox);
129130
}
130131
}

FitBitmapToOutlineAndMerge/FitBitmapToOutlineAndMerge.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<PlatformTarget>AnyCPU</PlatformTarget>
2929
<DebugType>pdbonly</DebugType>
3030
<Optimize>true</Optimize>
31-
<OutputPath>bin\Release\</OutputPath>
31+
<OutputPath>..\Build\BMPGerberMerger\</OutputPath>
3232
<DefineConstants>TRACE</DefineConstants>
3333
<ErrorReport>prompt</ErrorReport>
3434
<WarningLevel>4</WarningLevel>

FitBitmapToOutlineAndMerge/FitBitmapToOutlineAndMergeForm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void DoThread()
8080
string OutlineFile = OutlineFileBox.Text;
8181

8282
ParsedGerber PLS = null;
83-
PLS = PolyLineSet.LoadGerberFile(OutlineFile);
83+
PLS = PolyLineSet.LoadGerberFile(new StandardConsoleLog(), OutlineFile);
8484

8585
string SilkFile = SilkFileTopBox.Text;
8686
string BitmapFile = BitmapFileTopBox.Text;
@@ -186,7 +186,7 @@ private void OutlineFileBox_TextChanged(object sender, EventArgs e)
186186
{
187187
return;
188188
}
189-
PLS = PolyLineSet.LoadGerberFile(OutlineFile);
189+
PLS = PolyLineSet.LoadGerberFile(new StandardConsoleLog(), OutlineFile);
190190

191191
sizebox.Text = String.Format("{0}x{1}mm", PLS.BoundingBox.Width(), PLS.BoundingBox.Height());
192192

FrontPanelBuilder/FrontPanelBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private static void ConvertFile(string a, bool back)
8181
string f = basename + ".gko";
8282
if (System.IO.File.Exists(f))
8383
{
84-
PLS = PolyLineSet.LoadGerberFile(f);
84+
PLS = PolyLineSet.LoadGerberFile(new StandardConsoleLog(), f);
8585

8686

8787
string bottomcopper = basename + "/bottomcopper.gbl";

GerberAnalyse/GerberAnalyse.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public void AddFile(ProgressLog log, MemoryStream L, string filename)
199199
if (Layer == GerberLibrary.Core.BoardLayer.Outline || Layer == GerberLibrary.Core.BoardLayer.Mill)
200200
{
201201
L.Seek(0, SeekOrigin.Begin);
202-
var G = GerberLibrary.PolyLineSet.LoadGerberFileFromStream(new StreamReader(L), filename);
202+
var G = GerberLibrary.PolyLineSet.LoadGerberFileFromStream(new StandardConsoleLog(), new StreamReader(L), filename);
203203
Box.AddBox(G.BoundingBox);
204204
}
205205
}
@@ -228,12 +228,12 @@ public void AddFile(ProgressLog log, string L)
228228
GerberLibrary.Gerber.DetermineBoardSideAndLayer(L, out Side, out Layer);
229229
if (Layer == GerberLibrary.Core.BoardLayer.Outline || Layer == GerberLibrary.Core.BoardLayer.Mill)
230230
{
231-
var G = GerberLibrary.PolyLineSet.LoadGerberFile(L);
231+
var G = GerberLibrary.PolyLineSet.LoadGerberFile(log, L);
232232
Box.AddBox(G.BoundingBox);
233233
}
234234
else
235235
{
236-
var G = GerberLibrary.PolyLineSet.LoadGerberFile(L);
236+
var G = GerberLibrary.PolyLineSet.LoadGerberFile(log, L);
237237
}
238238
}
239239
break;

GerberLibrary/Artwork Related/FontSet.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,26 @@ public void Write(string p)
8181
writer.Close();
8282

8383
}
84+
public double StringWidth(string text, double size= 1.0)
85+
{
86+
double W = 0;
87+
double Scaler = size / CapsHeight; ;
8488

89+
for (int i = 0; i < text.Length; i++)
90+
{
91+
char t = text[i];
92+
var R = GetChar(t);
93+
if (R != null)
94+
{
95+
W += R.Advance * Scaler;
96+
}
97+
else
98+
{
99+
W += size;
100+
}
101+
}
102+
return W;
103+
}
85104
public LineSet GetChar(char t)
86105
{
87106
foreach(var ls in TheChars)

0 commit comments

Comments
 (0)