SliceyDicey 0.3.1

dotnet add package SliceyDicey --version 0.3.1
                    
NuGet\Install-Package SliceyDicey -Version 0.3.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SliceyDicey" Version="0.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SliceyDicey" Version="0.3.1" />
                    
Directory.Packages.props
<PackageReference Include="SliceyDicey" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SliceyDicey --version 0.3.1
                    
#r "nuget: SliceyDicey, 0.3.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SliceyDicey&version=0.3.1
                    
Install SliceyDicey as a Cake Addin
#tool nuget:?package=SliceyDicey&version=0.3.1
                    
Install SliceyDicey as a Cake Tool

SliceyDicey

A simple tool for parsing both ASCII-based and binary GCode files

Only reading for now, I have no need for writing my own files.

Reading ASCII-based GCode

// Arrange
string name = "some-random.gcode";
Stream input = new MemoryStream();

// Act
var file = await SliceyDicey.Lib.Gcode.GcodeParser.Parse(name, input, cancellationToken);

// Play around
var thumbnails = file.Thumbnails.ToList();
var filamentUsed = file.Comments
    .FirstOrDefault(x => x.Comment.StartsWith("filament used [mm] ="));
var linearMoves = file.Commands
    .Where(x => x.Command.StartsWith("G0 ") || x.Command.StartsWith("G1 "));

Reading binary GCode

// Arrange
Microsoft.Extensions.Logging.ILogger logger = null;
string name = "some-random.gcode";
Stream input = new MemoryStream();

// Act
var parser = new SliceyDicey.Lib.BinaryGcode.Parser(logger);
var file = await parser.Parse(name, input, cancellationToken);

// Play around
var thumbnails = file.Thumbnails.ToList();
var allInstructions = file.Instructions.ToList();
var comments = file.Comments.ToList();
var commands = file.Commands.ToList();

if (file.PrinterMetadata.TryGetValue("filament used [mm]", out var filamentUsed))
{
    logger.LogInformation("Using {0:.2f} mm of filament", decimal.Parse(filamentUsed));
}
else
{
    logger.LogWarning("File contains no filament usage information");
}

var linearMoves = file.Commands
    .Where(x => x.Command.StartsWith("G0 ") || x.Command.StartsWith("G1 "));
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.3.1 107 11/30/2024
0.3.0 233 12/2/2023
0.2.3 177 12/2/2023
0.2.2 147 12/2/2023
0.2.1 154 12/1/2023
0.1.0 186 11/7/2023