Gcode.Model.Program (gcode v0.4.1)

A G-code program is the high level object which contains each of the G-code blocks, comments, etc.

Example

iex> Program.init()
...> |> Result.unwrap!()
...> |> Enum.count()
0

Link to this section Summary

Types

t()

A G-code program

Functions

Initialise a new, empty G-code program.

Push a program element onto the end of the program.

Link to this section Types

Specs

Specs

error() :: {:program_error, String.t()}

Specs

t() :: %Gcode.Model.Program{elements: [element()]}

A G-code program

Link to this section Functions

Specs

init() :: Gcode.Result.t(t())

Initialise a new, empty G-code program.

iex> Program.init()
{:ok, %Program{elements: []}}
Link to this function

push(program, element)

Specs

push(t(), element()) :: Gcode.Result.t(t(), error())

Push a program element onto the end of the program.

iex> {:ok, program} = Program.init()
...> {:ok, tape} = Tape.init()
...> Program.push(program, tape)
{:ok, %Program{elements: [%Tape{}]}}