Skip to content

Commit

Permalink
Better Log Stack - framecreator - better pcb writer - makeicon etcetc
Browse files Browse the repository at this point in the history
  • Loading branch information
StijnKuipers committed Jul 10, 2020
1 parent d2cc445 commit 5b08cba
Show file tree
Hide file tree
Showing 36 changed files with 1,112 additions and 625 deletions.
7 changes: 4 additions & 3 deletions AutoPanelBuilder/AutoPanelBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using GerberLibrary.Core.Primitives;
using GerberLibrary;
using GerberLibrary.Core.Primitives;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -103,7 +104,7 @@ static void Main(string[] args)
{
foreach (var a in File.ReadAllLines(InputFile))
{
var A = GP.AddGerberFolder(a);
var A = GP.AddGerberFolder(new StandardConsoleLog(), a);
GP.AddInstance(a, new GerberLibrary.Core.Primitives.PointD(0, 0));
}
}
Expand All @@ -122,7 +123,7 @@ static void Main(string[] args)
GerberLibrary.GerberArtWriter GAW2 = new GerberLibrary.GerberArtWriter();
GerberLibrary.GerberArtWriter GAW = new GerberLibrary.GerberArtWriter();

GP.BuildAutoTabs(GAW, GAW2);
GP.BuildAutoTabs(new StandardConsoleLog(), GAW, GAW2);


string basepath = args[args.Count() - 1];
Expand Down
5 changes: 3 additions & 2 deletions DirtyPCBs/DirtyPCB_BoardStats/DirtyPCB_BoardStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using Ionic.Zip;
using System.Web.Script.Serialization;
using GerberLibrary;

namespace DirtyPCB_BoardStats
{
Expand Down Expand Up @@ -95,7 +96,7 @@ public void AddFile(GerberLibrary.ProgressLog log, MemoryStream L, string filena
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);
var G = GerberLibrary.PolyLineSet.LoadGerberFileFromStream(new StandardConsoleLog(), new StreamReader(L), filename);
Box.AddBox(G.BoundingBox);
}
}
Expand Down Expand Up @@ -124,7 +125,7 @@ public void AddFile(GerberLibrary.ProgressLog log, string L)
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);
var G = GerberLibrary.PolyLineSet.LoadGerberFile(log, L);
Box.AddBox(G.BoundingBox);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\Build\BMPGerberMerger\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down
4 changes: 2 additions & 2 deletions FitBitmapToOutlineAndMerge/FitBitmapToOutlineAndMergeForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void DoThread()
string OutlineFile = OutlineFileBox.Text;

ParsedGerber PLS = null;
PLS = PolyLineSet.LoadGerberFile(OutlineFile);
PLS = PolyLineSet.LoadGerberFile(new StandardConsoleLog(), OutlineFile);

string SilkFile = SilkFileTopBox.Text;
string BitmapFile = BitmapFileTopBox.Text;
Expand Down Expand Up @@ -186,7 +186,7 @@ private void OutlineFileBox_TextChanged(object sender, EventArgs e)
{
return;
}
PLS = PolyLineSet.LoadGerberFile(OutlineFile);
PLS = PolyLineSet.LoadGerberFile(new StandardConsoleLog(), OutlineFile);

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

Expand Down
2 changes: 1 addition & 1 deletion FrontPanelBuilder/FrontPanelBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private static void ConvertFile(string a, bool back)
string f = basename + ".gko";
if (System.IO.File.Exists(f))
{
PLS = PolyLineSet.LoadGerberFile(f);
PLS = PolyLineSet.LoadGerberFile(new StandardConsoleLog(), f);


string bottomcopper = basename + "/bottomcopper.gbl";
Expand Down
6 changes: 3 additions & 3 deletions GerberAnalyse/GerberAnalyse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void AddFile(ProgressLog log, MemoryStream L, string filename)
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);
var G = GerberLibrary.PolyLineSet.LoadGerberFileFromStream(new StandardConsoleLog(), new StreamReader(L), filename);
Box.AddBox(G.BoundingBox);
}
}
Expand Down Expand Up @@ -228,12 +228,12 @@ public void AddFile(ProgressLog log, string L)
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);
var G = GerberLibrary.PolyLineSet.LoadGerberFile(log, L);
Box.AddBox(G.BoundingBox);
}
else
{
var G = GerberLibrary.PolyLineSet.LoadGerberFile(L);
var G = GerberLibrary.PolyLineSet.LoadGerberFile(log, L);
}
}
break;
Expand Down
19 changes: 19 additions & 0 deletions GerberLibrary/Artwork Related/FontSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,26 @@ public void Write(string p)
writer.Close();

}
public double StringWidth(string text, double size= 1.0)
{
double W = 0;
double Scaler = size / CapsHeight; ;

for (int i = 0; i < text.Length; i++)
{
char t = text[i];
var R = GetChar(t);
if (R != null)
{
W += R.Advance * Scaler;
}
else
{
W += size;
}
}
return W;
}
public LineSet GetChar(char t)
{
foreach(var ls in TheChars)
Expand Down
Loading

0 comments on commit 5b08cba

Please sign in to comment.