internal void ScaleToFile(GerberNumberFormat GNF) { foreach (var a in Pairs) { switch (a.Value.Command) { case "X": case "Y": case "I": case "J": a.Value.Number = GNF._ScaleMMToFile(a.Value.Number); break; } } }
public static string WriteMacroPartVertices(List <PointD> Vertices, GerberNumberFormat format) { string res = ""; res += String.Format("4,1,{0}," + Gerber.LineEnding, (Vertices.Count - 2)); for (int i = 0; i < Vertices.Count - 1; i++) { res += String.Format("{0},{1}," + Gerber.LineEnding, Gerber.ToFloatingPointString(format._ScaleMMToFile(Vertices[i].X)).Replace(',', '.'), Gerber.ToFloatingPointString(format._ScaleMMToFile(Vertices[i].Y)).Replace(',', '.')); } res += "0*"; return(res); }
public static string MoveTo(PointD t, GerberNumberFormat GNF) { return(String.Format("X{0}Y{1}D02*", GNF.Format(GNF._ScaleMMToFile(t.X)), GNF.Format(GNF._ScaleMMToFile(t.Y)))); }
public static string BuildOutlineApertureMacro(string name, List <PointD> Vertices, GerberNumberFormat format) { string res = "%AM" + name + "*" + Gerber.LineEnding; res += String.Format("4,1,{0}," + Gerber.LineEnding, (Vertices.Count - 2)); for (int i = 0; i < Vertices.Count - 1; i++) { res += String.Format("{0},{1}," + Gerber.LineEnding, Gerber.ToFloatingPointString(format._ScaleMMToFile(Vertices[i].X)).Replace(',', '.'), Gerber.ToFloatingPointString(format._ScaleMMToFile(Vertices[i].Y)).Replace(',', '.')); } res += "0*" + Gerber.LineEnding + "%" + Gerber.LineEnding; return(res); }