Class: CrystalScad::LinearBearing::Lm_uu
- Inherits:
-
Assembly
- Object
- CrystalScadObject
- Primitive
- Assembly
- CrystalScad::LinearBearing::Lm_uu
- Defined in:
- lib/crystalscad/LinearBearing.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Assembly
#color, #hardware, #skip, #transformations, #x, #y, #z
Attributes inherited from Primitive
Attributes inherited from CrystalScadObject
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, #colorize, get_skip, get_views, #method_missing, #part, #scad_output, #show_hardware, skip, #threads, #transform, view, #walk_tree
Methods inherited from Primitive
#mirror, #rotate, #rotate_around, #scale, #transform, #translate, #union
Methods inherited from CrystalScadObject
#save, #to_rubyscad, #walk_tree, #walk_tree_classes
Constructor Details
#initialize(args = {inner_diameter:10}) ⇒ Lm_uu
Returns a new instance of Lm_uu.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/crystalscad/LinearBearing.rb', line 20 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 @@bom.add(description) unless args[:no_bom] == true end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class CrystalScad::Assembly
Instance Method Details
#description ⇒ Object
45 46 47 |
# File 'lib/crystalscad/LinearBearing.rb', line 45 def description "LM#{@args[:inner_diameter]}UU Linear bearing" end |
#dimensions ⇒ Object
53 54 55 56 57 |
# File 'lib/crystalscad/LinearBearing.rb', line 53 def dimensions diameter = @lm_uu[@args[:inner_diameter]][:diameter] length = @lm_uu[@args[:inner_diameter]][:length] return diameter, length end |
#output ⇒ Object
49 50 51 |
# File 'lib/crystalscad/LinearBearing.rb', line 49 def output show end |
#show ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/crystalscad/LinearBearing.rb', line 59 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 |