Class: HelicalGear

Inherits:
Shape
  • Object
show all
Defined in:
lib/rcad/gears.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, #render, #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(pitch_dia, height, helix_angle = Math::PI / 3.0) ⇒ HelicalGear

Returns a new instance of HelicalGear.



114
115
116
117
118
119
120
# File 'lib/rcad/gears.rb', line 114

def initialize(pitch_dia, height, helix_angle=Math::PI / 3.0)
  @height = height
  @helix_angle = helix_angle
  @profile = GearProfile.new(pitch_dia)

  @shape = profile.extrude(height, twist)
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



112
113
114
# File 'lib/rcad/gears.rb', line 112

def height
  @height
end

#helix_angleObject (readonly)

Returns the value of attribute helix_angle.



112
113
114
# File 'lib/rcad/gears.rb', line 112

def helix_angle
  @helix_angle
end

#profileObject (readonly)

Returns the value of attribute profile.



112
113
114
# File 'lib/rcad/gears.rb', line 112

def profile
  @profile
end

Instance Method Details

#twistObject



122
123
124
125
126
127
# File 'lib/rcad/gears.rb', line 122

def twist
  twist_length = Math::tan(helix_angle) * height
  pitch_circumference = Math::PI * profile.pitch_dia

  twist_length * (2 * Math::PI / pitch_circumference)
end