Gcode.Model.Program (gcode v1.0.0)

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

example

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

@type error() :: {:program_error, String.t()}
@type t() :: %Gcode.Model.Program{elements: [element()]}

A G-code program

Link to this section Functions

@spec 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)

@spec 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{}]}}