Class: HexNut
- Inherits:
-
BaseBoltPart
- Object
- Shape
- BaseBoltPart
- HexNut
- Defined in:
- lib/rcad/nuts.rb
Instance Attribute Summary collapse
-
#full ⇒ Object
Returns the value of attribute full.
-
#xytol ⇒ Object
Returns the value of attribute xytol.
-
#ztol ⇒ Object
Returns the value of attribute ztol.
Attributes inherited from BaseBoltPart
Instance Method Summary collapse
-
#initialize(bolt_dia, xytol = 0, ztol = 0, full = false) ⇒ HexNut
constructor
A new instance of HexNut.
- #render ⇒ 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, xytol = 0, ztol = 0, full = false) ⇒ HexNut
Returns a new instance of HexNut.
30 31 32 33 34 35 36 |
# File 'lib/rcad/nuts.rb', line 30 def initialize(bolt_dia, xytol=0, ztol=0, full=false) super(bolt_dia) @xytol = xytol @ztol = ztol @full = full end |
Instance Attribute Details
#full ⇒ Object
Returns the value of attribute full.
28 29 30 |
# File 'lib/rcad/nuts.rb', line 28 def full @full end |
#xytol ⇒ Object
Returns the value of attribute xytol.
28 29 30 |
# File 'lib/rcad/nuts.rb', line 28 def xytol @xytol end |
#ztol ⇒ Object
Returns the value of attribute ztol.
28 29 30 |
# File 'lib/rcad/nuts.rb', line 28 def ztol @ztol end |
Instance Method Details
#render ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rcad/nuts.rb', line 38 def render d = nut_dia_across_corners + @xytol h = nut_height + @ztol nut = reg_prism(6, d / 2.0, h) if full return nut else return sub do ~nut ~cylinder(h + 0.02, bolt_dia + @xytol) .move_z(-0.01) end end end |