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

#*, #+, #-, #bbox, #extrude, #max_x, #max_y, #max_z, #min_x, #min_y, #min_z, #move_x, #move_y, #move_z, #render, #revolve, #rot_x, #rot_y, #rot_z, #scale_x, #scale_y, #scale_z, #x_size, #y_size, #z_size, #~@

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