slice

package module
v0.0.0-...-d9d02c0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2017 License: BSD-2-Clause Imports: 15 Imported by: 0

README

Slice

Slice is a set of tools and Go packages for compiling STL files into toolpaths for 3D printers.

Package documentation

What works:

  • Perimeter slicing
  • Sliced layer previews

What doesn't work:

  • Printing with generated G-code

Try it out

go get -t -u sigint.ca/slice/cmd/preview
cd $GOPATH/src/sigint.ca/slice
go build sigint.ca/slice/cmd/preview
./preview testdata/pikachu.stl

Click and drag up and down to scroll through layers.

Documentation

Overview

Package slice provides types and functions for slicing and compiling STL format 3D models into G-code to be used for 3D printing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Concentric

type Concentric struct {
	Spacing float64
}

func (*Concentric) Fill

func (in *Concentric) Fill(r *Region)

type Config

type Config struct {
	DebugMode bool

	LayerHeight float64
	LineWidth   float64

	Infill Infiller
}

A Config variable specifies a slicing configuration.

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) EncodeLayer

func (e *Encoder) EncodeLayer(l *Layer)

EncodeLayer compiles a layer into gcode.

type Infiller

type Infiller interface {
	Fill(*Region)
}

An Infiller Fills a perimeter.

type Layer

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

func Slice

func Slice(s *stl.Solid, cfg Config) ([]*Layer, error)

Slice slices and stl.Solid into layers.

func (*Layer) Draw

func (l *Layer) Draw(dst draw.Image)

func (*Layer) Regions

func (l *Layer) Regions() []*Region

type Region

type Region struct {
	Exterior  []*Segment   // Exteriors perimeter
	Interiors [][]*Segment // interior perimeters
	Infill    []*Segment   // infill lines
	// contains filtered or unexported fields
}

type Segment

type Segment struct {
	From, To Vertex2   // ordered so that gcode movements are from "from" to "to"
	Normal   vector.V2 // points to the inside of the solid
	// contains filtered or unexported fields
}

Segments can represent both perimeter and infill lines

func (*Segment) Length

func (s *Segment) Length() float64

func (*Segment) ShiftBy

func (s *Segment) ShiftBy(v vector.V2) *Segment

func (*Segment) String

func (s *Segment) String() string

type Vertex2

type Vertex2 struct {
	X, Y float64
}

func (Vertex2) String

func (v Vertex2) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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