Class: Gcodify::Ops::HoleOp

Inherits:
Gcodify::Op show all
Defined in:
lib/gcodify/ops/holeop.rb

Overview

A hole to be drilled. In @options, no :radius or :diameter is specified or necessary, since that's determined by the drill-bit that you put in the machine.

Instance Attribute Summary

Attributes inherited from Gcodify::Op

#options

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ HoleOp

Special notice: @options is what the drilling cycle will rapid down to, if not specified it's 0.2in

Parameters:


12
13
14
15
# File 'lib/gcodify/ops/holeop.rb', line 12

def initialize(options)
	@options = options
	@options[:r_position] = @options[:r_position] || 0.2
end

Instance Method Details

#to_gcodeString

Creates the gcode. Gcodify::Ops::HoleOp uses canned drill cycles.

Returns:

  • (String)

    the generated gcode


20
21
22
23
24
25
# File 'lib/gcodify/ops/holeop.rb', line 20

def to_gcode
  gcode = "Z1.0\n"
  gcode << "X#{@options[:at][0]} Y#{@options[:at][1]}"
  gcode << "G99 G81 R#{@options[:r_position]} Z#{@options[:depth] + @options[:r_position]}\n"
  gcode << "G80\n"
end