bgcodego

package module
v0.0.0-...-3b04527 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2025 License: BSD-3-Clause Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

bgcodego - pure-Go implementation of bgcode standard

Work In Progress:

  • Parse bgcode
  • Convert from bgcode to gcode
  • Convert from gcode to bgcode

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(fd io.Reader) (string, error)

Parse converts a BGCode input into regular GCode output

Types

type BlockEncoding

type BlockEncoding uint16
const (
	BlockEncodingINI BlockEncoding = 0
)

type BlockFileMetadata

type BlockFileMetadata struct {
	Values KeyValues
	// contains filtered or unexported fields
}

BlockFileMetadata according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#file-metadata

func (*BlockFileMetadata) Parse

func (bfm *BlockFileMetadata) Parse(r io.Reader, hdr *BlockHeader) error

func (*BlockFileMetadata) Render

func (bfm *BlockFileMetadata) Render() string

type BlockGCode

type BlockGCode struct {
	Body string
	// contains filtered or unexported fields
}

BlockGCode according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#gcode

func (*BlockGCode) Parse

func (bg *BlockGCode) Parse(r io.Reader, hdr *BlockHeader) error

func (*BlockGCode) Render

func (bg *BlockGCode) Render() string

type BlockHeader

type BlockHeader struct {
	// contains filtered or unexported fields
}

BlockHeader according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#block-header

func (*BlockHeader) Compression

func (bh *BlockHeader) Compression() BlockHeaderCompression

func (*BlockHeader) Inflate

func (bh *BlockHeader) Inflate(body []byte) ([]byte, error)

func (*BlockHeader) Length

func (bh *BlockHeader) Length() uint32

func (*BlockHeader) Parse

func (bh *BlockHeader) Parse(r io.Reader) error

func (*BlockHeader) Type

func (bh *BlockHeader) Type() BlockHeaderType

type BlockHeaderCompression

type BlockHeaderCompression uint16

BlockHeaderCompression according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#block-header

const (
	BlockHeaderCompressionNone          BlockHeaderCompression = 0
	BlockHeaderCompressionDeflate       BlockHeaderCompression = 1
	BlockHeaderCompressionHeatshrink114 BlockHeaderCompression = 2
	BlockHeaderCompressionHeatshrink124 BlockHeaderCompression = 3
)

func (BlockHeaderCompression) IsValid

func (bhc BlockHeaderCompression) IsValid() bool

func (BlockHeaderCompression) String

func (bhc BlockHeaderCompression) String() string

type BlockHeaderType

type BlockHeaderType uint16

BlockHeaderCompression according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#block-header

const (
	BlockHeaderTypeFileMetadata    BlockHeaderType = 0
	BlockHeaderTypeGCode           BlockHeaderType = 1
	BlockHeaderTypeSlicerMetadata  BlockHeaderType = 2
	BlockHeaderTypePrinterMetadata BlockHeaderType = 3
	BlockHeaderTypePrintMetadata   BlockHeaderType = 4
	BlockHeaderTypeThumbnail       BlockHeaderType = 5
)

func (BlockHeaderType) IsValid

func (bht BlockHeaderType) IsValid() bool

type BlockPrintMetadata

type BlockPrintMetadata struct {
	Values KeyValues
	// contains filtered or unexported fields
}

BlockPrintMetadata according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#print-metadata

func (*BlockPrintMetadata) Parse

func (bprm *BlockPrintMetadata) Parse(r io.Reader, hdr *BlockHeader) error

func (*BlockPrintMetadata) Render

func (bprm *BlockPrintMetadata) Render() string

type BlockPrinterMetadata

type BlockPrinterMetadata struct {
	Values KeyValues
	// contains filtered or unexported fields
}

BlockPrinterMetadata according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#printer-metadata

func (*BlockPrinterMetadata) Parse

func (bprm *BlockPrinterMetadata) Parse(r io.Reader, hdr *BlockHeader) error

func (*BlockPrinterMetadata) Render

func (bprm *BlockPrinterMetadata) Render() string

type BlockRenderer

type BlockRenderer interface{ Render() string }

type BlockSlicerMetadata

type BlockSlicerMetadata struct {
	Values KeyValues
	// contains filtered or unexported fields
}

BlockSlicerMetadata according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#slicer-metadata

func (*BlockSlicerMetadata) Parse

func (bsm *BlockSlicerMetadata) Parse(r io.Reader, hdr *BlockHeader) error

func (*BlockSlicerMetadata) Render

func (bsm *BlockSlicerMetadata) Render() string

type BlockThumbnail

type BlockThumbnail struct {
	Body []byte
	// contains filtered or unexported fields
}

BlockThumbnail according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#thumbnail

func (*BlockThumbnail) Parse

func (bt *BlockThumbnail) Parse(r io.Reader, hdr *BlockHeader) error

func (*BlockThumbnail) Render

func (bt *BlockThumbnail) Render() string

type BlockThumbnailFormat

type BlockThumbnailFormat uint16

BlockThumbnailFormat according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#thumbnail

const (
	BlockThumbnailFormatPNG BlockThumbnailFormat = 0
	BlockThumbnailFormatJPG BlockThumbnailFormat = 1
	BlockThumbnailFormatQOI BlockThumbnailFormat = 2
)

func (BlockThumbnailFormat) String

func (btf BlockThumbnailFormat) String() string

type ChecksumType

type ChecksumType uint16

ChecksumType for FileHeader Refer to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#file-header

const (
	ChecksumTypeNone  ChecksumType = 0
	ChecksumTypeCRC32 ChecksumType = 1
)

func (ChecksumType) IsValid

func (ct ChecksumType) IsValid() bool

type FileHeader

type FileHeader struct {
	MagicNumber  uint32
	Version      FileHeaderVersion // Version of the G-code binarization
	ChecksumType ChecksumType      // Algorithm used for checksum
}

FileHeader implements https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#file-header

func (*FileHeader) Parse

func (fh *FileHeader) Parse(r io.Reader) error

type FileHeaderVersion

type FileHeaderVersion uint32

FileHeaderVersion for FileHeader Refer to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#file-header

const (
	Version1 FileHeaderVersion = 1
)

func (FileHeaderVersion) IsValid

func (fhv FileHeaderVersion) IsValid() bool

type GCodeEncoding

type GCodeEncoding uint16

GCodeEncoding according to https://github.com/prusa3d/libbgcode/blob/main/doc/specifications.md#gcode

const (
	GCodeEncodingNone                 GCodeEncoding = 0
	GCodeEncodingMeatpack             GCodeEncoding = 1
	GCodeEncodingMeatpackWithComments GCodeEncoding = 2
)

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue is the tuple used by tables inside of the blocks.

type KeyValues

type KeyValues []KeyValue

func (KeyValues) First

func (kv KeyValues) First(key string) string

func (KeyValues) Render

func (kvs KeyValues) Render() string

Source Files

  • meatpack.go
  • spec.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL