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.
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
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?
i'll check it on 2.73 as soon as i can (i didn't look at the add-on for quite some time so something might have broken between Blender versions)
ReplyDeleteFive years later... this plugin is excellent ! It works nicely, since I would like to keep on using 2.7x Blender versions. thank you for this nice job.
ReplyDelete