Class: RintCore::GCode::Object
- Inherits:
-
Object
- Object
- RintCore::GCode::Object
- Includes:
- Codes
- Defined in:
- lib/rint_core/g_code/object.rb
Constant Summary
Constants included from Codes
Codes::ABS_EXT_MODE, Codes::ABS_POSITIONING, Codes::COMMENT_SYMBOL, Codes::CONTROLLED_MOVE, Codes::DISABLE_MOTORS, Codes::DWELL, Codes::EMRG_STOP, Codes::ENABLE_MOTORS, Codes::FAN_OFF, Codes::FAN_ON, Codes::GET_EXT_TEMP, Codes::GET_FW_DETAILS, Codes::GET_POSITION, Codes::HEAD_OFFSET, Codes::HOME, Codes::IDLE_HOLD_OFF, Codes::INIT_SD, Codes::LIST_SD, Codes::PAUSE_SD_PRINT, Codes::POWER_OFF, Codes::POWER_ON, Codes::RAPID_MOVE, Codes::RELEASE_SD, Codes::REL_EXT_MODE, Codes::REL_POSITIONING, Codes::SD_PRINT_STATUS, Codes::SELECT_SD_FILE, Codes::SET_BED_TEMP_NW, Codes::SET_BED_TEMP_W, Codes::SET_EXT_TEMP_NW, Codes::SET_EXT_TEMP_W, Codes::SET_LINE_NUM, Codes::SET_POSITION, Codes::SET_SD_POSITION, Codes::SLEEP, Codes::START_SD_PRINT, Codes::START_SD_WRITE, Codes::STOP, Codes::STOP_SD_WRITE, Codes::USE_INCHES, Codes::USE_MILLIMETRES, Codes::WIAT_FOR_TEMP
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
-
#e_travel ⇒ Object
readonly
Returns the value of attribute e_travel.
-
#filament_used ⇒ Object
readonly
Returns the value of attribute filament_used.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#layers ⇒ Object
Returns the value of attribute layers.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#raw_data ⇒ Object
Returns the value of attribute raw_data.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#x_max ⇒ Object
readonly
Returns the value of attribute x_max.
-
#x_min ⇒ Object
readonly
Returns the value of attribute x_min.
-
#x_travel ⇒ Object
readonly
Returns the value of attribute x_travel.
-
#y_max ⇒ Object
readonly
Returns the value of attribute y_max.
-
#y_min ⇒ Object
readonly
Returns the value of attribute y_min.
-
#y_travel ⇒ Object
readonly
Returns the value of attribute y_travel.
-
#z_max ⇒ Object
readonly
Returns the value of attribute z_max.
-
#z_min ⇒ Object
readonly
Returns the value of attribute z_min.
-
#z_travel ⇒ Object
readonly
Returns the value of attribute z_travel.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data = nil) ⇒ Object
constructor
A new instance of Object.
Constructor Details
#initialize(data = nil) ⇒ Object
Returns a new instance of Object.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rint_core/g_code/object.rb', line 15 def initialize(data = nil) if data.class == String && self.class.is_file?(data) data = self.class.get_file(data) end return false if data.blank? || data.class != Array @raw_data = data @imperial = false @relative = false @lines = [] data.each do |line| line = RintCore::GCode::Line.new(line) @lines << line if line.raw.present? end process end |
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def depth @depth end |
#e_travel ⇒ Object (readonly)
Returns the value of attribute e_travel.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def e_travel @e_travel end |
#filament_used ⇒ Object (readonly)
Returns the value of attribute filament_used.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def filament_used @filament_used end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def height @height end |
#layers ⇒ Object
Returns the value of attribute layers.
10 11 12 |
# File 'lib/rint_core/g_code/object.rb', line 10 def layers @layers end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def lines @lines end |
#raw_data ⇒ Object
Returns the value of attribute raw_data.
10 11 12 |
# File 'lib/rint_core/g_code/object.rb', line 10 def raw_data @raw_data end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def width @width end |
#x_max ⇒ Object (readonly)
Returns the value of attribute x_max.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def x_max @x_max end |
#x_min ⇒ Object (readonly)
Returns the value of attribute x_min.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def x_min @x_min end |
#x_travel ⇒ Object (readonly)
Returns the value of attribute x_travel.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def x_travel @x_travel end |
#y_max ⇒ Object (readonly)
Returns the value of attribute y_max.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def y_max @y_max end |
#y_min ⇒ Object (readonly)
Returns the value of attribute y_min.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def y_min @y_min end |
#y_travel ⇒ Object (readonly)
Returns the value of attribute y_travel.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def y_travel @y_travel end |
#z_max ⇒ Object (readonly)
Returns the value of attribute z_max.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def z_max @z_max end |
#z_min ⇒ Object (readonly)
Returns the value of attribute z_min.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def z_min @z_min end |
#z_travel ⇒ Object (readonly)
Returns the value of attribute z_travel.
11 12 13 |
# File 'lib/rint_core/g_code/object.rb', line 11 def z_travel @z_travel end |
Class Method Details
.get_file(file) ⇒ Object
35 36 37 |
# File 'lib/rint_core/g_code/object.rb', line 35 def self.get_file(file) IO.readlines(file) end |
.is_file?(file) ⇒ Boolean
31 32 33 |
# File 'lib/rint_core/g_code/object.rb', line 31 def self.is_file?(file) file.present? && File.exist?(file) && File.file?(file) end |