Class: Laser::Cutter::Sloped::Panels
- Inherits:
-
Object
- Object
- Laser::Cutter::Sloped::Panels
- Defined in:
- lib/laser/cutter/sloped/panels.rb
Overview
The panels of a sloped box, each drawn in its own frame and without kerf: two side walls, the bottom, the back, the tilted panel, and the top and front strips when the box has them.
Along every joint the two panels that meet take opposite middle notches, so they interlock. A side wall takes a hole everywhere; the back and the front strip take a tab on every edge; the bottom and the top strip take a tab into the side walls and a hole into the back and the front strip.
Constant Summary collapse
- NAMES =
The names of the panels, in the order they are drawn.
%w[left right bottom back top tilted front].freeze
Instance Method Summary collapse
-
#initialize(profile:, width:, notcher:, lid:) ⇒ Panels
constructor
A new instance of Panels.
-
#sizes ⇒ Hash{String => Array(Float, Float)}
The inside size of each panel, which is what a Placement flips it within.
-
#to_h ⇒ Hash{String => Geometry::Loop}
The outline of each panel the box has, by name.
Constructor Details
#initialize(profile:, width:, notcher:, lid:) ⇒ Panels
Returns a new instance of Panels.
23 24 25 26 27 28 29 30 |
# File 'lib/laser/cutter/sloped/panels.rb', line 23 def initialize(profile:, width:, notcher:, lid:) @profile = profile @width = width.to_f @notcher = notcher @lid = lid @corners = Corners.new(profile: profile, width: width, notcher: notcher) freeze end |
Instance Method Details
#sizes ⇒ Hash{String => Array(Float, Float)}
The inside size of each panel, which is what a Placement flips it within.
42 43 44 45 46 47 |
# File 'lib/laser/cutter/sloped/panels.rb', line 42 def sizes side = [@profile.depth, @profile.height] { 'left' => side, 'right' => side, 'bottom' => [@width, @profile.depth], 'back' => [@width, @profile.height], 'top' => strip(@profile.top_strip_length), 'tilted' => [@width, @profile.tilted_length], 'front' => strip(@profile.front_strip_length) }.compact end |
#to_h ⇒ Hash{String => Geometry::Loop}
Returns the outline of each panel the box has, by name.
33 34 35 36 37 |
# File 'lib/laser/cutter/sloped/panels.rb', line 33 def to_h side = SidePanel.new(profile: @profile, notcher: @notcher, lid: @lid).loop { 'left' => side, 'right' => side, 'bottom' => bottom, 'back' => back, 'top' => top, 'tilted' => tilted, 'front' => front }.compact end |