[Addon] Gears 2.0 (WIP)

I started work on version 2.0 of my Gears script. The idea is that in should be able to replace the gears script that current part of Blender standard addon distribution.

Its key features are:

  • all gears are parametric objects (so you can tweak them again at any time)
  • a gear train is fully animated from the start (with drivers etc.)
  • it’s very user friendly (or at least that’s what it should become :slight_smile:

Detailed information, including an example video and links to code on my blog.

cheers.

Wow, this is great. I did not realize we could code AddOns as modifiers? I may have to re-write a few of my own once I figure out how you have achieved this.

I put your posted release through a few tests to see if it plays well with other modifiers on the stack. It seems to. The main problem I ran into is that if i make a change to a Gear parameter it jumps back to the origin. It would be nice if the regeneration code simply left the object alone and only updated the mesh datablock.

Here is a gear with a sub-surf shrink wrapped projected to a cube with a subsurf modifier.

Attachments


well, it’s not really a modifier, it’s just that the options happen to be positioned in a panel that lives in the modifiers tab. It’s a practice I copied from marcatore and dragonlee because I also find it a more logical place for options of a parametric object.

I did not check very thoroughly if the addon plays nice with real modifiers (I did check with subsurf, bevel and edgesplit) so your test is very useful. Could you perhaps detail your steps a bit more so that I can reproduce it?

(the addon does indeed move the object but parenting to the empty should keep it in place)

Very cool script! I’ve only been playing with it a few minutes, but the thing I find strange (which I’m sure you’re probably already working on) is that when you add a new gear either from the add menu or convert an existing mesh object to a gear I would expect it to create a new ‘GearHeadEmpy.***’ empty and not parent it to the same empty. Only when I press the ‘Gear’ button in the modifier panel would I expect it to be parented to the same empty and have it’s drivers set.

Oh! Also I did notice that you are creating a new meshes every time you change any settings even the ‘twin’ and ‘driver’ settings which I think if the gear properties were animated could result in a lot of system memory being use to store lots of meshes with no users, I have never used bmesh but changing line 243 from:

me = bpy.data.meshes.new(“Gear”)

to:

me = g.data

and removing 246:

g.data = me

Seems to fix the problem.

Having used other 3d packages for along time I see the logic of having it in the modifier stack but maybe from a Blender users point of view it should be in the object view or split between the object and object data views. At the very least you need to add a check so it’s only visible if you select a mesh object.

Thank you for sharing this script.

@dbo: thank you for your remarks. User friendliness is important to me so I will certainly look into the issue of not creating a new GearHeadEmpty. Doing so would indeed be more logical but it would also imply that there could be more than one set of gears and not all functions inside the script can handle that (yet).

As for reusing bmeshes: I will check again but I thought I explicitely freed the bmeshes I used (at least those created inside the script) so I don’t think there is a real problem. Thinking about animating the properties I realize there might be another problem: each time a property changes the keyframes on the gearhead are reset, which is probably not such a good idea if you want to control the animation yourself :slight_smile: This is design flaw: I wanted the gears to be animated but I never thought there would be people who wanted to animate the properties :slight_smile: So that’s certainly something that needs to be addressed.

Version 0.0.2 is now available. Makes it possible to position a gear out-of-line (i.e. rotated along the edge of the gear that is driving it).

The video at the start of the blog entry is probably a better illustration of what I mean :slight_smile:

Mind you, the script at its current status is riddled with print statements for debugging, so not (yet) ‘production quality’ :slight_smile:

( the video mentioned here is no longer at the start of the blog entry. For those interested:

)

added support for worm gears and helical gears and although the are animated the automatic configuration of the driven gears is not yet done, but the parameters are more or less documented.

An example:


version 0.0.4 adds an internal gear option which makes it possible for example to create a planetary gear quite easily.

Download instructions plus a short workflow on how to create the setup in the video can be found in http://blenderthings.blogspot.nl/2013/09/gears-20-work-in-progress-blender-addon.html

Check your “this update” as it is blank.

thnx JWise, fixed it.

Cool stuff.

Version 0.0.5 now supports involute gears. That’s because I really want to start printing some actual gears. I am pretty sure the code for the tooth shape is correct is (I even added options for fillet, backlash and pressure angle) but if there happens to be a real engineer reading this I appreciate any serious C&C (I am just a physicist, for me 1% is already close enough :slight_smile:

Anyway, check this blog article for more details, including download instructions.

BTW, v0.0.5 also supports tapering of the gears. For the rest the integration will need some polishing (if one gear has an involute tooth shape, the other gears should autmatically change to involute too, otherwise it won’t work well in real life. Likewise, two involute gears should have the same pressure angle. Also, internal gears with an involute tooth shape are not supported yet).

Cheers,

– Michel.

v0.0.6 now has a better dedendim profile and a shift option that allows for taller addendum/ shallower dedendum or vice versa.

this is crazy useful!

thanks!

Great addon I got it working “out the box” I am looking forward to the updates

This is exactly the script I’ve been looking for. However, I can’t figure out how to get it going. This is merely my inexperience with running scripts. Here’s what I’ve done:
I downloaded your script from github. I followed the instructions on your blog to “install from file.” However, your Gear addon doesn’t appear on the list of Addons. That is, unless it’s named something else and I’m not seeing it. Is there someplace I can get more basic info on installing scripts? I’m missing something.

@austintxous: this might be helpful: http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Add-Ons

also please note that contrary to most addons the controls for this one aee in the modifiers tab, not in some add menu

@varkenvarken, really brilliant add-on. I wanted to see if it was yet possible to have multiple sets of gears. It doesn’t seem so, but I wanted to make sure I wasn’t doing something wrong.

thanks!!

i am glad you like it :slight_smile: and, no, you’re not doing anything wrong, the addon basically looks for all objects with the ‘gears’ property and treats them as one big set of gears.

i’ll think about a solution. Meanwhile you could strip all custom properties (at the lower end of the object panel) once you’re satisfied with the first set and then start creating a second one. Deleting the custom properties will not alter the meshes or the drivers so this should work (i have not tested this myself yet :wink:

cheers,

–michel.

Your workaround works perfectly. Many thanks!