Showing posts with label gears. Show all posts
Showing posts with label gears. Show all posts

Gears addon updated for Blender 2.73

Blender 2.73 introduced some breaking changes in de Python BMesh API so prompted by user reports I updated the Gears script. The new version is available on GitHub (version 0.0.7)

Gears 2.0 (work in progres), part V, a Blender add-on

I am happy to announce that version 0.0.5 of the Gears 2.0 script is now available on GitGub. Its main new feature is the option the create involute gears, the most widely used tooth shape in modern gearing designs.

The accuracy of the involute curve can be controlled with the steps parameter and extra space below the dedendum can be created with the fillet parameter. Likewise, extra backlash can be created between the teeth with the backlash parameter. I haven't yet printed any gears so I can't vouch for their actual mechanical behavior but for now I think this is a good start (although the shape of the fillet/undercut could be better I guess). [edit: v0.0.6 now has a shift parameter which for positive values gives a taller addendum and a shallower dedendum and for negative values the opposite. This is useful to tweak the load a gear can bear. Obviously these values should best match on adjacent gears but that is not yet done automatically]

Although I do not approximate the involute curve of the tooth with splines, this article was invaluable in getting the equations correct without trying to find it out all by myself. An example set of parameter settings is shown at the end.

Gears 2.0, a work in progress

The script is discussed on this thread on Blenderartists, feel free to comment there. It also has its own entry in Blenders upload tracker.
The code is available from GitHub, install it in the usual way from

File->User preferences->Addons->Install from file and don't forget to check the checkbox to actually activate it.

As the example below shows for a 44 teeth gear of radius 1, the fillet/undercut needs some work (it's too wide/deep) but the shape of the involute tooth itself seems ok. The read circle is the pitch radius, the blue circle the base radius (that is pitch radius * cosine( pressure angle )).

The settings to produce the gear shown above were:

Gears 2.0 (work in progress), a Blender addon, part IV

As you can see version 0.0.4 adds an option for an internal gear. It is a very slight enhancement, just 4 or 5 lines but it makes it possible to create the setup shown in the clip in a few seconds.

Planetary gear workflow

  • Add the first gear from the add mesh menu
  • Add the second gear from the gears panel in the modifier tab by clicking the 'Gear' button,
  • Select the first gear again and add another planet gear; use the rotation option to position it relative to the central gear,
  • Repeat the previous step for any additional planet gear,
  • Select one of the planet gear and add the outer gear. Select the 'Internal' option from the type drop down,
  • Adjust the number of teeth for any of the gears to taste,
  • Set some rotation keyframes for the gearhead empty to make the whole setup rotate a bit,
  • Done ;-)

Gears 2.0 (work in progress), a Blender addon



Update: version 0.0.2 now supports out of line gears and is available from GitHub

Update: version 0.0.3 now supports worm gears and helical gears and is available from GitHub. Note that when you create a worm gear (by choosing a low number of teeth and a large helical angle, e.g. 4 and 360) you have to manually fiddle to get a fitting driven gear, automatic calculation is on my list but with 20 minutes a day (see aside) there's only so much you can do :-)


Note the two new parameters: helical angle, which is the amount of twist around the axis, and flip, which is the rotation around the axis of the gear train. The latter s needed because a driven gear is at 90 degrees relative to a worm gear.






A long time ago I wrote an addon for Blender 2.49 to create gears or cogwheels. It works quite well and it even is included as part of Blenders bundled scripts. Over the years it was maintained by other developers so it still works for Blender 2.68.

Recently Brendon Murphy (meta-androcto) asked me to look into the Gears script to resolve some bugs and while working on another plugin (the floorboard generator) I started thinking about completely redesigning the script. The most important issues prompting this redesign were:
Bmesh
When the script was written, Bmesh support in Blender was not even a glimmer of an idea so the code that creates the actual geometry isn't exactly elegant. Redesigning for Bmesh not only makes for cleaner code but is also a personal incentive to learn more about this Api, which isn't always completely documented (return values from operators are often dictionaries with all kind of geometry information yet the different values they contain are often not described in full) but which is both powerful (supporting complex operations like duplication and extrusion) and fast (implemented in C/C++, Python is just a thin wrapper).
Parameterization
When I was working on the floorboard generator Marcatore showed me a design by DragonLee to make options persistent. The original gears addon suffers from the same affliction as many other addons in that once the object is created you cannot easily tweak it. You can of course manually alter the mesh but the option sliders are gone from the toolbar as soon as the mesh is manipulated in any way. What we really want is the possibility to tweak the options even after saving and reloading the .blend and this exactly what DragonLee's method makes possible, paving the way for truly parametric objects.
Animation suport
Configuring a rig or drivers to let one cogwheel drive a bunch of other cogwheels is not that simple and rather time consuming. So the new design should feature drivers and keyframes that allow for instant animation, which then of course may be adapted to your specific needs.
User friendliness
Many addons are not written with user friendliness in mind and I am guilty of this sin as well. There are basically two solutions to this problem (and they can be used in parallel): One, use your own addon extensively, asking yourself with each mouseclick if it is necessary and with each option you introduce if its description is clear and relevant, and two, interact with the community, for example on Blenderartists. Ask what features they miss and ask explicitely how usability might be improved. Do this early on, not when your script is almost finished, although it should already be quite usable when you introduce it, otherwise no one will try it out.
With those considerations in mind I present you:

Gears 2.0, a work in progress

The script is discussed on this thread on Blenderartists, feel free to comment there. It also has its own entry in Blenders upload tracker.
The code is available from GitHub, install it in the usual way from

File->User preferences->Addons->Install from file and don't forget to check the checkbox to actually activate it.

Workflow

The workflow in general is very simple:
  • Add the first gear that will drive the rest of the mesh with Add->Mesh->Add Gear
  • Locate the Gears panel in the modifiers tab of the properties
  • Add as many gears as you need by clicking Gear (the button at the bottom of the panel)
  • Select each gear in turn and alter its properties as needed
At this point you will have an animated gear train. You can step through the frames to see it move. At the location of the first gear is a spherical empty (called GearHeadEmpty) which can be moved and rotated to position the whole gear assembly in any way you like.
To recreate the gears in the opening image/video go through the following steps:
Add the first gear
Click Add->Mesh->Add Gear
Add four additional gears
Click Gear four times in the Gears panel in Modifiers tab of the Properties
Give the first gear 20 teeth
Select the first gear and adjust the Number of teeth to 20
Give the second gear 6 teeth
Select the second gear and adjust the number of teeth like you did for the first gear
Give the third gear 20 teeth
Just like the first and second gears
Give the fourth gear 6 teeth
Should be familiar by now
Give the fifth gear 20 teeth
You should be able to do this with your eyes closed by now :-)
Twin the second gear to the first
Select the second gear and choose Up from the Twin dropdown. The gear will move to the location of first gear, slightly shifted along the z-axis and its animated rotation will be identical to that of the first gear, all as if both gears are connected to the same gear axis.
Twin the fourth gear to the third
Select the fourth gear and choose Up from the Twin dropdown like you did for the second gear.
Done!
Step through the frames or press ctrl-A to see the gear assembly move.

Road map (provisional)

Whatever will be developed depends of course on the feedback I get but my personal list features the following items (in no particular order):
  • rotate gear out of line, to allow a more varied placement of the gears
  • parameterization of tooth (size, margin, angle)
  • parameterized depth, taper and twist (to make conical and helical gears)
  • spokes + axes
  • uv-map
  • material slots w. simple cycles material.[gear, spoke, axis]
  • worm gear?