Accurate modeling of a gear

Hi 809iLink,

the gears are created in Shapr3D, saved in 3mf, and animated using openSCAD (https://openscad.org/), a freeware 3D program that is the absolute opposite of Shapr3D : everything is done through program lines. So it is very complementary (but 3D rendering quality is low compared to shapr3D’ visualization).

To animate gears, we just need to know how to import a .3mf file, rotate and translate it.

The video shows the whole process, which is very simple.

The special variable $t increments automatically from 0 to 1 when animate is selected in the view menu, so as a consequence, the variable angle increments from 0 to 360.

I keep the first gear centered to the origin and just rotate it around the Z axis by an amount equal to the value of the angle variable.

The second gear needs to be translated by a distance equal to the sum of the radius of both gears, hence the (D1+D2)/2 value, with D1 and D2 the diameter of gear 1 and gear 2.

The second gear also need to be rotated around the Z axis before the translation by an angle equal to the rotation of the first gear multiplied by the ratio of gears’ diameter D1/D2, and second gear rotates in opposite direction as first gear, hence the -angle/2 value for the correct rotation. I did it step by step on the video so we see it build up progressively.

The action list reads from right to left. For the second gear, we :

  • import the Gear40mm.3mf file
  • apply the color lightgreen
  • rotate around the Z axis by an angle equal to -angle/2
  • translate along the X axis by a value equal to (D1+D2)/2

A few tips:
1/ create the gears in Shapr3D, centered to the origin
2/ save the gears in .3mf or .stl format in a folder
3/ launch openSCAD, create a program and save it in the same folder as the gears (or use full path name for the files)
4/ select animate in the view menue, which displays 3 additional controls on the window

Last but not least, it is possible to automatically generate a picture for each frame of the animation, which is save in the same folder as the programme. You can then create an animated GIF from them, which is how I created the animations on this post.

Not so complicated actually :grinning:, you just need to figure out what is the movement of each part and take into account the rotation direction and speed ratio of the gears.

Very useful actually to check that there is no interference during the meshing of the gears that were modeled with Shapr3D.

2 Likes