Class: Gcodify::Program

Inherits:
Object
  • Object
show all
Includes:
OpsMixin
Defined in:
lib/gcodify/program.rb

Overview

Represents a GCode program. It contains a property @ops, which is an array of all the ops, in order, in the program.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OpsMixin

#circular_pocket, #face, #gcode, #hole

Constructor Details

#initializeProgram

Returns a new instance of Program


12
13
14
# File 'lib/gcodify/program.rb', line 12

def initialize
  @ops = []
end

Instance Attribute Details

#opsObject

Access all ops in the program


8
9
10
# File 'lib/gcodify/program.rb', line 8

def ops
  @ops
end

Instance Method Details

#to_gcodeString

Converts the Gcodify::Program to a Gcode string

Returns:

  • (String)

    the Gcode


19
20
21
22
23
24
25
26
# File 'lib/gcodify/program.rb', line 19

def to_gcode
  gcode = ""
  @ops.each do |op|
    # Append that Op's generated gcode to the full gcode string
    gcode << op.to_gcode
  end
  gcode # Return the generated gcode
end