Class: SolidRuby::Assemblies::Lm_uu
- Inherits:
-
Assembly
- Object
- SolidRubyObject
- Assembly
- SolidRuby::Assemblies::Lm_uu
- Defined in:
- lib/solidruby/assemblies/linear_bearing.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Assembly
#hardware, #skip, #transformations, #x, #y, #z
Attributes inherited from SolidRubyObject
#attributes, #children, #siblings, #transformations
Instance Method Summary collapse
- #description ⇒ Object
- #dimensions ⇒ Object
-
#initialize(args = { inner_diameter: 10 }) ⇒ Lm_uu
constructor
A new instance of Lm_uu.
- #output ⇒ Object
- #show ⇒ Object
Methods inherited from Assembly
#*, #+, #-, #add_to_bom, #color, #colorize, get_skip, get_views, #part, #scad_output, #show_hardware, skip, #threads, #transform, view, #walk_tree
Methods inherited from SolidRubyObject
#&, alias_attr, #debug, #debug?, #mirror, #place, #rotate, #rotate_around, #save, #scale, #to_rubyscad, #translate, #union, #walk_tree, #walk_tree_classes
Constructor Details
#initialize(args = { inner_diameter: 10 }) ⇒ Lm_uu
Returns a new instance of Lm_uu.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/solidruby/assemblies/linear_bearing.rb', line 18 def initialize(args = { inner_diameter: 10 }) @args = args @lm_uu = { 3 => { diameter: 7, length: 10 }, 4 => { diameter: 8, length: 12 }, 5 => { diameter: 10, length: 15 }, 6 => { diameter: 12, length: 19 }, 8 => { diameter: 15, length: 24 }, 10 => { diameter: 19, length: 29 }, 12 => { diameter: 21, length: 30 }, 13 => { diameter: 23, length: 32 }, 16 => { diameter: 28, length: 37 }, 20 => { diameter: 32, length: 42 }, 25 => { diameter: 40, length: 59 }, 30 => { diameter: 45, length: 64 }, 35 => { diameter: 52, length: 70 }, 40 => { diameter: 60, length: 80 }, 50 => { diameter: 80, length: 100 }, 60 => { diameter: 90, length: 110 } } @shell_thickness = 1.1 BillOfMaterial.bom.add(description) unless args[:no_bom] == true end |
Instance Method Details
#description ⇒ Object
42 43 44 |
# File 'lib/solidruby/assemblies/linear_bearing.rb', line 42 def description "LM#{@args[:inner_diameter]}UU Linear bearing" end |
#dimensions ⇒ Object
50 51 52 53 54 |
# File 'lib/solidruby/assemblies/linear_bearing.rb', line 50 def dimensions diameter = @lm_uu[@args[:inner_diameter]][:diameter] length = @lm_uu[@args[:inner_diameter]][:length] [diameter, length] end |
#output ⇒ Object
46 47 48 |
# File 'lib/solidruby/assemblies/linear_bearing.rb', line 46 def output show end |
#show ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/solidruby/assemblies/linear_bearing.rb', line 56 def show diameter, length = dimensions shell = cylinder(d: diameter, h: length) shell -= cylinder(d: diameter - @shell_thickness * 2, h: length + 0.2).translate(z: -0.1) shell = shell.color('LightGrey') inner = cylinder(d: diameter - @shell_thickness * 2, h: length) inner -= cylinder(d: @args[:inner_diameter], h: length + 0.2).translate(z: -0.1) inner = inner.color('DimGray') shell + inner end |