feat: add CoordinateFormatter for Cincinnati G-code coordinate output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 23:29:06 -04:00
parent 5d26efb552
commit 24cd18da88
2 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
namespace OpenNest.Posts.Cincinnati
{
public sealed class CoordinateFormatter
{
private readonly int _accuracy;
private readonly string _format;
public CoordinateFormatter(int accuracy)
{
_accuracy = accuracy;
_format = "0." + new string('#', accuracy);
}
public string FormatCoord(double value)
{
return System.Math.Round(value, _accuracy).ToString(_format);
}
public static string Comment(string text) => $"( {text} )";
public static string InlineComment(string text) => $"({text})";
}
}