Class: Bolt
- Inherits:
-
BaseBoltPart
- Object
- Shape
- BaseBoltPart
- Bolt
- Defined in:
- lib/rcad/nuts.rb
Instance Attribute Summary collapse
-
#bolt_len ⇒ Object
Returns the value of attribute bolt_len.
-
#xytol ⇒ Object
Returns the value of attribute xytol.
-
#ztol ⇒ Object
Returns the value of attribute ztol.
Attributes inherited from BaseBoltPart
Instance Method Summary collapse
- #head_height ⇒ Object
-
#initialize(bolt_dia, bolt_len, xytol = 0, ztol = 0) ⇒ Bolt
constructor
A new instance of Bolt.
- #render ⇒ Object
- #total_len ⇒ Object
Methods inherited from BaseBoltPart
#nut_dia_across_corners, #nut_dia_across_flats, #nut_height
Methods inherited from Shape
#*, #+, #-, #align, #back, #bbox, #bottom, #center, #cx, #cy, #cz, #extrude, #front, #left, #maxx, #maxy, #maxz, #minx, #miny, #minz, #mirror, #mirror_x, #mirror_y, #mirror_z, #move, #move_x, #move_y, #move_z, #revolve, #right, #rot_x, #rot_y, #rot_z, #rotate, #scale, #scale_x, #scale_y, #scale_z, #top, #transform, #xcenter, #xsize, #ycenter, #ysize, #zcenter, #zsize, #~@
Constructor Details
#initialize(bolt_dia, bolt_len, xytol = 0, ztol = 0) ⇒ Bolt
Returns a new instance of Bolt.
60 61 62 63 64 65 66 |
# File 'lib/rcad/nuts.rb', line 60 def initialize(bolt_dia, bolt_len, xytol=0, ztol=0) super(bolt_dia) @bolt_len = bolt_len @xytol = xytol @ztol = ztol end |
Instance Attribute Details
#bolt_len ⇒ Object
Returns the value of attribute bolt_len.
58 59 60 |
# File 'lib/rcad/nuts.rb', line 58 def bolt_len @bolt_len end |
#xytol ⇒ Object
Returns the value of attribute xytol.
58 59 60 |
# File 'lib/rcad/nuts.rb', line 58 def xytol @xytol end |
#ztol ⇒ Object
Returns the value of attribute ztol.
58 59 60 |
# File 'lib/rcad/nuts.rb', line 58 def ztol @ztol end |
Instance Method Details
#head_height ⇒ Object
68 69 70 |
# File 'lib/rcad/nuts.rb', line 68 def head_height 0.7 * bolt_dia end |
#render ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rcad/nuts.rb', line 76 def render d = nut_dia_across_corners + @xytol h = head_height + @ztol head = reg_prism(6, d / 2.0, h) add do ~head ~cylinder(total_len + @ztol, bolt_dia + @xytol) .move_z(-head_height) end end |
#total_len ⇒ Object
72 73 74 |
# File 'lib/rcad/nuts.rb', line 72 def total_len bolt_len + head_height end |