MeatPack.NET
0.2.0
dotnet add package MeatPack.NET --version 0.2.0
NuGet\Install-Package MeatPack.NET -Version 0.2.0
<PackageReference Include="MeatPack.NET" Version="0.2.0" />
<PackageVersion Include="MeatPack.NET" Version="0.2.0" />
<PackageReference Include="MeatPack.NET" />
paket add MeatPack.NET --version 0.2.0
#r "nuget: MeatPack.NET, 0.2.0"
#:package MeatPack.NET@0.2.0
#addin nuget:?package=MeatPack.NET&version=0.2.0
#tool nuget:?package=MeatPack.NET&version=0.2.0
MeatPack.NET
A .NET encoder and decoder for MeatPack, Scott Mudge's
G-code packing scheme (BSD-3-Clause; see LICENSE.meatpack), used by Marlin hosts over serial and
by Prusa's binary G-code container for its G-code blocks.
The scheme packs the fifteen most common G-code characters two to a byte through a 4-bit table;
0b1111 in a nibble announces a full-width character, 0xFF announces two, and a doubled 0xFF
introduces a command byte toggling packing or the no-spaces table variant (in which E takes the
space's slot).
The packing is deliberately lossy — writers strip spaces from G-command lines and pad odd-length
lines with a newline — so the decoder also owes the reconstruction the reference implementations
perform: a space re-inserted before each parameter letter on a G line, the padding after a
newline dropped, and consecutive newlines collapsed. The output is equivalent G-code, not the
packer's original bytes. This behaviour is pinned against real PrusaSlicer output in the
libbgcode.NET repository this package is
developed in.
There is no malformed MeatPack — unknown commands are ignored, every other byte is packed data or passthrough — so decoding never throws, and the output is bounded by a small constant multiple of the input.
Usage
using MeatPack.NET;
byte[] gcodeText = MeatPackDecoder.Unpack(packedBytes);
// And the other direction - the reference packer's line treatment exactly:
// comments kept or dropped, inline comments cut, G-lines space-stripped with
// serial checksums recomputed, the no-spaces table variant on by default.
byte[] packed = MeatPackEncoder.Pack("G1 X10 Y20\nM104 S210\n", keepComments: true);
License
Mozilla Public License 2.0. The MeatPack scheme itself is Scott Mudge's, BSD-3-Clause,
carried in LICENSE.meatpack.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MeatPack.NET:
| Package | Downloads |
|---|---|
|
libbgcode.NET
A .NET reader and writer for Prusa's binary G-code (bgcode) container format: file header, block enumeration, per-block compression (deflate, heatshrink), MeatPack G-code encoding and decoding, CRC-32 checksums, the JSON metadata PrusaSlicer 3 writes, and whole-file conversion to and from ASCII G-code. Implemented from the published format specification; the reader is hardened against untrusted input, the writer cannot produce a file the reference implementation refuses. |
GitHub repositories
This package is not used by any popular GitHub repositories.