Worm Gear

Introductory Notes

This notebook creates a simple worm and mesh gear. We then rotate both parts in a short list animation.

Define Graphics

Define Our Global Variables

Off[General::"spell1"];

Worm Gear Parameters

helixRadius = 4; helixLength = 8; helixTurns = 5; helixSteps = 100; wormShaftDiagonal = 1; wormShaftStart = -5;

Cog Parameters

nTeeth = 20; toothSeparation = (helixLength/helixTurns); circumference = nTeeth toothSeparation; radius = (circumference/(2 π)); Xposition = radius + helixRadius; toothDepth = (helixRadius/4); turningRatio = (1/nTeeth);

Create Worm Gear Graphics

The worm gear is a finely spaced helix protruding from a central cylinder.

helixCurve = 
      Table[N[{helixRadius Sin[2 π helixTurns t], 
            helixRadius Cos[2 π helixTurns t], helixLength t}], {t, 
          -0.5, 0.5, (1/helixSteps)}];

helixPolygons = 
      Table[{Hue[(i/helixSteps)], 
          Polygon[{helixCurve[[i]], 
              helixCurve
                [[i + 1]], {0.1, 0.1, 1}
                   helixCurve
                  [[i + 1]], {0.1, 0.1, 
                  1} helixCurve[[i
                  ]]}]}, {i, Length[helixCurve] - 1}];

Create teeth of the simple cog.

wormGraphics = 
      Graphics3D[{Hue[0], 
          Cuboid[{-wormShaftDiagonal, -wormShaftDiagonal, 
              wormShaftStart}, {wormShaftDiagonal, wormShaftDiagonal, 
              helixLength + 0.5}], helixPolygons}];

radianStep = ((2 π)/(nTeeth 5)); cogGraphics = 
      Graphics3D[{Thickness[0.04], Hue[0], 
          Line[Table[
              d = radius + toothDepth Sin[theta nTeeth]; {
                Xposition + d Cos[theta], 0, d Sin[theta]}, {theta, 0, 
                2 π, radianStep}]]}];

Create Objects in Dynamic Visualizer

Start Dynamic Visualizer.

<< DynamicVisualizer`

\(ClearVisualizer[]; 

    SetOptions[Camera["Camera"], Visible -> False]; \)

Define the model range.

SetOptions[$DefaultModel3D, 
      ModelRange -> {{-7, -7, -7}, {16, 16, 16}}];

Create objects in Dynamic Visualizer.

\(CreateObject[Object3D["Worm"], wormGraphics, 
      InvariantPoint -> {0, 0, 0}, InteractiveMovement -> False]; 

    CreateObject[Object3D["Cog"], cogGraphics, 
      InvariantPoint -> {Xposition, 0, 0}, 
      InteractiveMovement -> False]; \)

Animate

Create a list animation and send it to Dynamic Visualizer.

\(anim = 
      Table[{DV`SetOptions[Object3D["Worm"], 
            AxisAndAngle -> {{0, 0, 1}, ψ}], 
          DV`SetOptions[Object3D["Cog"], 
            AxisAndAngle -> {{0, 1, 0}, turningRatio\ ψ}]}, {
          ψ, 0, 8\ π, π\/8}]; 
Visualize[anim]; \)

You can repeat this animation from within Dynamic Visualizer.