I ported Dr. Rainer Hessmer's excellent Involute Spur Gear Builder to C++/Windows 64.
I modified the DXF export to be more friendly to Autodesk's Inventor.
Gear Bakery generates regular gears, internal gears, and rack and pinions.
Export to DXF or directly to Inventor.
Get version 3.05: Get it here
If you use this tool, please post about it here. I would love to know what you are doing with it. Pictures are always welcome, too.
Version 3 provides an updated GUI as well as improved zoom and panning. A lot of code was changed, so please let me know if there are any regressions.

After importing into Inventor, the gears should look like this:

You can then extrude as needed.
This project uses code from:
- J. Fernández, L. Cánovas and B. Pelegrín, DECOPOL-Codes for decomposing a polygon into convex subpolygons, European Journal of Operational Research 102 (1997) 242-243 (doi:10.1016/S0377-2217(97)
00225-7 ). - J. Fernández, L. Cánovas and B. Pelegrín, Algorithms for the decomposition of a polygon into convex polygons, European Journal of Operational Research 121 (2000) 330-342 (doi:10.1016/S0377-2217(99)
00033-8 ) - J. Fernández, B. Tóth, L. Cánovas and B. Pelegrín, A practical algorithm for decomposing polygonal domains into convex polygons by diagonals, Top 16 (2008) 367-387 (doi: 10.1007/s11750-008-0055-2).
128 comments:
Thank you so much for porting this tool, it is such a joy to use compared to anything Autodesk ever came up with.
Hi Doug,
It looks like you made a great stand alone Spur Gear Builder, however, the link does not work.
Would it be possible for you to update to a working link.
Thanks!
The link should work now.
Been looking for something like this for a while, works great! I was able to import a DXF of an internal gear set into SolidWorks and it extrudes beautifully. Many thank to you and Dr. Hessmer.
I need this magnificent tool with 32bit verion.
It is possible?
Please.
Thank you Dr, it's a great works!
I'm trying to design an internal ring setup where the internal ring has a pitch circle dia. of 10.75" and 150 teeth mated to an external gear with 3.1" PCD and 42 teeth. I"m pretty sure I can do it with this utility, but can't quite come the the desired result. Do I need to enter any teeth counts as a negative number.
I need to update the project to VS 2017. I'll look into this issue when I get it running again.
I increased the tooth limit to 250 and posted the new version in the link.
@Radek Kierzek
It would take a great deal of work to recompile all the dependent libraries to 32 bit. Sorry.
Hey there, i'm getting an error about a missing .dll when i attempt to start the program, and i can't for the the life of me figure out how to fix the issue.
The file is "ippi90lgc.dll"
The full System Error message reads:
"The code execution cannot proceed because ippi90lgc.dll was not found. Reinstalling the program may fix this problem."
Sorry for the dll omission. It is a new dependency. I have added a link to it above.
Please let me know if there are any other issues.
Thank you Dough, it works perfectly now.
Thank you Doug for all you have put it to making this program. I get an "ERROR: Area is not closed!" message when I run the program. Any suggestions as to what I am doing wrong?
Thanks Tony
PS I can email you some screen shots if it would help.
@Tony Bullard
The area message occasionally occurs because of floating point roundoff in the CSG code. Please send or post the parameters you are using.
Thanks Doug,
" Please send or post the parameters you are using. "
I sent you the parameters 11-17-2018 in a return email message.
I did not get the email, unfortunately. Please send it to rogers.doug AT gmail.com
Done.
Sorry I didn't see the "noreply" address I sent it to.
I have posted an update that should address the "area is not closed" issue.
Another update to fix more issues that Tony provided. Thanks Tony!
Also added a save button that saves the parameters to the file GearBakery.ini. This is loaded at start up.
Thank you Doug. The program runs very fast with high resolution DXF output. Just what I needed to produce a quality spur gear.
Keep up the great work, Thank you!
Tony
Doug, brilliant! Thanks for your work on GearBakery. I notice that when I click on Export to DXF, the program does not prompt for a file name, but saves as gear_0.dxf and gear_1.dxf. Is this correct operation of the program?
Also, I notice that the drawings output also show a circle at (presumably) the pitch diameter superimposed on the gear profile. Is this correct operation of the program?
Thank you.
Burford
@Burford
Thanks for the nice comments.
I did hard code the names to gear_0 and gear_1. I can add a file dialog easily if it would help you.
The circle in the DXF should not be exported. It was for debugging only. I must not have disabled it for release mode. If this is an issue for you, I can disable this.
Doug,
I think that having a file dialog would be helpful.
I can delete the circle after importing to a CAD program, so I don't think that will be a problem.
I also notice that at my monitor setting (2736 x 1824), the dialog windows and output window are very small, which makes it hard to read the labels. Is there a way to get them to scale proportionally to the monitor setting (or for me to make them bigger)?
Thank you!
@Burford
Unfortunately, the GUI that I am using (GLUI) does not support resizing the fonts. I spent some time investigating and so many things are hardcoded to GLUT_BITMAP_HELVETICA_12
I'll look into the other issues.
Update posted to allow font size and dxf file naming. Let me know if I broke something by moving to Qt.
That sounds promising!
Okay, just tried it. I unzipped GearBakery 2.0 to a folder and double-clicked on the .exe. It crashed with this message in the console window:
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Should I install something to get it to run?
Thank you!
This is Qt's way of indicating a .dll is missing. I wish it list which one it was trying to load. Based on the packages I used, it looks like it is the OpenGL dlls. I'll update the post with links.
Doug,
Still no joy! I put the OpenGL.dll in the folder with the GearBakery.exe, and the application still fails to open:
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Here are the files I have in the directory:
04/08/2019 08:29 PM 33,352,192 GearBakery.exe
07/20/2012 06:24 AM 206,336 glut32.dll
11/21/2018 08:42 PM 86,121,624 ippi90lgc.dll
04/05/2019 06:46 PM 6,129,152 Qt5Core.dll
03/07/2019 11:14 AM 6,459,392 Qt5Gui.dll
04/11/2019 10:55 PM 322,560 Qt5OpenGL.dll
03/07/2019 11:16 AM 5,579,776 Qt5Widgets.dll
11/23/2018 06:16 PM 1,269 README.txt
08/07/2017 10:30 PM 262,456 tbb.dll
I can't open Doug's new GearBaker either.
I neglected to use qtdeploy to create the dependencies. I have updated the zip to use Qt's deployment tool.
That did it! Thanks Doug, nice job.
Okay! Getting close now... the program now runs for me without error (yay!). I can resize the parameter entry dialog box, and it is nice to be able to enter my own file name for the output and save into a folder of my choosing. However, the program does not seem to respond to parameter changes entered into the dialog box. For example, I tried setting the Wheel 1 and Wheel 2 parameters to be the same (10 tooth count, 10.00 bore hole dia), and I notice these things:
1. The GearBakery window which shows the result still shows a larger gear and a smaller gear (29 teeth on the larger, 11 on the smaller), and the bore size does not seem to have changed)
2. The DXF output similarly outputs a larger gear (29 teeth on the larger, 11 on the smaller) with small bore size.
Thank you for continuing to improve your nifty program!
Thanks for the feedback. I can look at this tomorrow.
This is a strange one. Debug version works fine, but release mode does not. Investigating.
Compiler bug in VS2019. Release build was optimizing my lambda function away. I posted 2.01 as a replacement.
Bingo! Works as it should now! I'll poke around with the other options and see if I find anything else not working right.
Thank you for wringing out the bugs and adding the new functionality.
I'm happy to support the users of this software. Both of them ;)
I use a monitor setting (1360 x 768) and now the window is way to long. I can't see the data output text box. Is there a way to make the text box another output window? I use the data that in the text box so it's kinda importent to me.
Thanks for all your effort Doug.
The text box is now a separate window.
The text box really worked out well. I still have to set my resolution to 1600 x 900 to see enough of the Fast Zoom Button to click it. That is no big deal for me. I can live with that. Thanks!
You can change the font to make everything smaller, if you like.
"Added command line -f to set font size. Example: GearBakery -f 12"
Will you enplane more of how to use this command line -f? Thank you.
The command line is what is passed to a program to provide options at startup. They are typically provided using the command line interface.
You can also make a shortcut to GearBakery.exe. In the properties of the shortcut, you can add
-f 10
to the command line options. -f is used to indicate an option and 10 in this case is the option value.
When I am back at my desk I can provide more details.
To make a command line shortcut for GearBakery to change the font size:
Open directory where GearBakery.exe is located.
Right click onto GearBakery.exe, and hold down.
Move mouse to open space. Let go.
In popup window, select "Create Shortcut here". You can rename the shortcut. Anything is fine, like GearBakerySmallFont.
Right click on shortcut, select "Properties"
Under "Shortcut" tab, in "Target" window, add -f 8, where 8 is the font size you want
Like this:
"C:\Users\drogers\Documents\Visual Studio 2010\Projects\Gears\GearBakery\GearBakery.exe" -f 8
Hit "OK"
Now use the shortcut to always run the program with the font specified.
Looks like 6 reduces the font size from the default.
Thanks Doug. Good explanation and it works well.
Are you planning to make the source available to this? I would love to port it to C#.
@LarsBB At this point, it would take too much work to create a version I can post.
Doug, I get the following error message when starting Gearbaery2.0qt5.
qt.qpa.fonts: Unable to open default EUDC font: "C:\\WINDOWS\\FONTS\\EUDC.TTE"
and it doesn't export to DXF. I've reloaded the program to no avail. Any help would be appreciated.
Thanks, Tony
Doug, I've got it fixed. I had to create file name and put it in a directory and then select it to save to.
That is really odd. Thank you for posting about it. I will look at this.
Another problem I’m having is it saves Config to GearBakery.ini but it doesn’t load from it. It loads the fault you show at the top of your page.
I will look into it. Thanks.
Looks like I implemented 'save', but no 'load'. Not so useful ;)
I added a load button that will load the same .ini file. I still have no idea about the Qt issue.
All the .ini is saved but the first three entries are not reloaded. The defaults are loaded. 0, 0, and 8.
Also no mater what I enter as a pitch number the default 8 is used for calculations and output. It will not use another number than 8.
Thanks. I only loaded the spinner box values. I will add the others.
Added first three entries to load.
It still isn’t saving and using the pitch number, the third field. No mater what number I put in there it uses the number 8 in all output and calculations.
When it runs it read the number in the ini and not the number in the pitch textbox. If I edit the ini to a different pitch number it will run that number correctly. If I enter a different number in the pitch textbox it still runs the ini number.
Doug, could you also change the Clearance, Backlash and bore Diameter textboxes to three decimal places—(.000)?
Thanks,
Tony
Updated to increase precision in the spinner boxes
Thanks for the precision change. It works great.
Maybe for clarity the Pitch Type section could be relabeled:
Label for section: Pitch
Label for type field: Type
Label for pitch field: Pitch
I don’t think you code is picking up pitch field. It’s getting the pitch from elsewhere.
Thanks for looking into this.
I have changed the labeling. It will be included in the next update.
As for pitch, it doesn't get used directly. Depending on the pitch type, the pitch specified value is used as an input.
switch (params.pitchType)
{
case CIRCULAR_PITCH:
gear2CircularPitch = params.pitchInput;
break;
case DIAMETRAL_PITCH:
gear2CircularPitch = M_PI / params.pitchInput;
break;
case PITCH_DIAMETER:
{
if (params.gearType == GearType_e::GEAR_RACK)
{
// use for second gear
double pitchDiameter = params.pitchInput;
double diametralPitch = (double)params.wheel2ToothCount / pitchDiameter;
gear2CircularPitch = M_PI / diametralPitch;
gear1InputType = PitchType_e::CIRCULAR_PITCH;
gear1InputValue = gear2CircularPitch;
}
else
{
double pitchDiameter = params.pitchInput;
double diametralPitch = (double)params.wheel1ToothCount / pitchDiameter;
gear2CircularPitch = M_PI / diametralPitch;
}
break;
}
}
Thanks Doug,
What I’m suggesting is the pitch number input textbox is not “params.pitchInput”.
Run the program with all your defaults, (pitch number = 8). The data in the output textbox window and the DXF output are correct.
Change the pitch number to 10 and run again. None of the output data has changed. Change any of the other parameters and run again. The output has changed but it is all based on pitch number 8.
“params.pitchInput” is not picking up the pitch number input textbox. It picks up the other 16 parameters correctly.
Another indication the code doesn’t read the pitch number textbox:
Enter 10 in the textbox. “Save Config” and open the ini. 8 is in the field where 10 should be. No 10 in the ini.
Nice find Tony. The spinner was never setting the pitch value. This bug has been there from the beginning. The fix is in the 2.07, just posted. Thanks for the feedback.
Great job with the fix Doug! All seems to work well now. Thank you for this great program. Heep up the good work.
Tony
Doug,
I have been looking for something that would allow me to design some planetary gears to 3D print, and this program has mostly looked good so far! However, I have run into two problems.
One is minor and involves the pitch diameter after import into SolidWorks and Inventor being equal to the number of teeth instead of the listed pitch diameter. This is simple enough to fix since it only requires scaling by the Diametral Pitch but a bit inconvenient (though this may be intended behavior).
The second issue is much more significant. I no longer have a preview and can no longer export gears. This seems to have happened after generating an internal gear. Restarting program & computer and unzipping & running a new instance did not fix the issue. Reset camera does nothing, even after computing. The information panel still displays correct information. Exporting results in the seemingly same very broken internal gear regardless of the parameters calculated. Calculating an internal gear causes immediate crash (no error).
Any help getting this to work again would be greatly appreciated. Does it save any files outside of its working directory that might have gotten corrupted?
Thank you,
Alex
Hi Alex,
I'm happy to fix any issues you are having. Can you give me a more detailed wark through on what you are getting vs. what you are expecting?
Right now, it just saves in the current directory, but I can make a dialog box where to save the output.
I'm looking at the first issue now.
Are you exporting to DXF, then importing?
Thanks for the quick reply!
In regards to the second issue:
Here is a screenshot of the input I used for a regular 20-tooth gear (notice lack of preview despite camera reset) and the output .dxf I get now:
https://i.imgur.com/yUbBqDs.png
https://i.imgur.com/oGJCQdK.png
Here is the output .dxf for the same settings but 40 teeth:
https://i.imgur.com/oGJCQdK.png
Here is what I previously exported and would expect with the same settings as the 40-tooth gear (except hole size of 0):
https://i.imgur.com/Y2SuO8a.png
Finally, here is an example of internal gear setting that crashes with no error after I hit calculate:
https://i.imgur.com/cLQYM0i.png
Keep in mind, this was all with a fresh unzip of the program. I haven't done anything with saving/loading configs here.
Thanks again for your assistance.
Forgot to do proper tags for links:
20 Tooth Settings
20 Tooth .dxf
40 Tooth .dxf
Previous and Expected 40 Tooth .dxf
Internal Gear settings prior to crash
For the first issue: yes, exporting .dxf then opening with SolidWorks and tested opening with Inventor with the same result. In case it helps, I am setting pitch with Diametral Pitch.
There actually is a preview, it's just really, really small. You can get a glimpse of the preview by zooming in with LMB + moving up/down. I need to address when gears are this small.
What is in the preview is not what is exported, though. The export looks like what you are seeing. The preview looks very different. I will see why.
I will fix the preview first.
I played around a bit more and discovered you are correct about it being really small.
It looks like really small stuff hits the clip plane before it gets to a useful size. If this is the case, wouldn't it be better to just scale the graphics instead of moving closer and farther from a perspective viewport?
Also, I swear I get stuck in a rotate mode sometimes, but the object has been too small to confirm.
I think my initial exports somehow didn't accept the Diametral Pitch of 40 and had somehow calculated with a DP of 1, thus the diameter is the number of teeth. Also, I hadn't paid attention to the scale of the backlash and clearance. By setting them an order of magnitude lower, it fixes the weird internal-gear-looking output. It also fixes crashing on internal gear.
I have determined both problems to be linked to the Diametral Pitch and the scale of backlash and clearance. It may be that under certain circumstances DP doesn't load correctly, or it may just be I forgot to set it initially (I don't think I have any way of telling at this point).
I confirmed rotate mode.
Steps to reproduce:
1. Start program
2. Calculate any gear that would be visible in preview
3. Click and drag with LMB
4. LMB will continue to be rotate until clicking with RMB, after which LMB will also be zoom
Thanks for your feedback. I really appreciate it. I came to the same conclusion about the viewport. I am just going to make it am ortho 2D view and just scale.
I converted the view to ortho 2D and just scaled up and down. I will look at the export next.
There was an issue with the button state not being cleared which is why the controls were spotty.
Thank you for helping me out and being so quick on fixing the preview.
This really is a great program. I spent several entire days earlier this week trying to find some kind of gear generator that would work for me, and this was the only one that didn't have some kind of deal-breaking issue for me: usually lacking internal gear or being slow to the point of unusable when imported into SolidWorks.
As for the export issue, what was still not working? I was able to export and 3D print after I made sure the Diametral Pitch was set and the backlash and clearance was scaled way down (like 0.005 for each).
I fixed some issues that I thought were unrelated to the export. I then went to look at the export issue you posted about, but I could not reproduce them. Are you still having any issues?
I am going to make a pass to clean up The GUI. If you have any suggestions, please feel free to share them.
I have no issue with the export. It was probably my fault before...
My preference for controls would be LMB for panning and scroll wheel for scale.
Panning speed changes with zoom, so maybe either compensate for this or flip the order of the scale and translate on the object. If I am not mistaken, the latter will always zoom to the object center, so that may not be the best option.
It feels like scale is currently additive, which doesn't feel natural to me. I would suggest something more like
if (deltaMouseY > 0) scale *= 1.1 * deltaMouseY * speedFactor
if (deltaMouseY < 0) scale /= 1.1 * abs(deltaMouseY) * speedFactor
Parameters Panel Wishlist:
* Some way of highlighting fields with invalid data (e.g. hole size), like space for a red bar to appear to the right of it.
* Recompute automatically check box that runs compute any time a field is changed
I updated the GUI and changed the zoom and pan interface. I also made file dialogs for saving configurations.
Constant updates are a problem because I get too many updates, making it unusable.
There is still the issue with the configuration Alex sent. I will look into it. It may be that the size is too small.
@Alex, I would love to see some pictures of the gears you created from GearBakery.
Doug, No mater how high I set my screen resolution I can’t see any controls below Reset Camera.
Resolution is 1600 x 900. Max for for me.
I put the controls in a scrollable panel and adding back the reporting. Version 3.01.
Thanks, Doug.
Now I get an error window (Not Responding) if I use anything other then Circular Pitch.
I was not getting that in debug mode. I will have a look.
It happens when an error occurs. Fix coming soon.
Pictures of my 2.5" wide 1:49 2-stage planetary gearbox:
Sun and Planet in Gear Bakery
Planet and Ring in Gear Bakery
Planetary Assembly in CAD A
Planetary Assembly in CAD B
All 3D Printed Parts
Printed Carrier, Planets, and Sun Assembled: Input Side
Printed Carrier, Planets, and Sun Assembled: Output Side
Fully Assembled
@Alex, that is so cool! It's nice to see your work. Awesome.
@Tony, 3.02 posted. Fixes crash on error and I made the text at the bottom collapsable to get more area for the controls. Thanks for your patience.
Minor update to 3.03. I reduced the size of the control panel. Just replace the existing .exe.
Great job, Doug.
Now I'm getting a Windows error message on GearBakery Exit.
"GearBakery.exe has stopped working" with three options. The debug option shows qwindows.pdb not loaded.
I could send you screen shots in an email if I had it.
@Tony, thanks I'll have a look. I am able to reproduce this.
@Tony. The crash issue should be fixed. Thanks for the feedback.
Nice job, Doug. I also like the ability to save multiple ini files.
Hi!
Good work with this program!
I tried it now for first time. When I export to dxf the dxf-files appears. When I try to import them I get nothing, no error when import either. So far I try to import in SolidWorks 2017 and LibreCAD.
Using version 3.04.
See my name was Unknown!
Google account was not working.
My name is Ronny Heijdenberg
/Regards
Is there any data in the named dxf file you saved? Open it in a text editor to see.
My first few lines look something like this.
999
dxflib 3.12.2.0
0
SECTION
2
HEADER
9
$ACADVER
1
AC1015
9
$HANDSEED
5
FFFF
0
ENDSEC
I can't view the object in the dxf file either. I'm using AutoCad 2007 and Rhinoceros 4.0
Gear 1 file length in Version 3.04 is 1115 lines.
The same gear in Version 2.07 is 15,787 lines.
2.07 loads. 3.04 does not.
That is odd because I have not touched any of the DXF export code in a long time. I will have a look.
@Tony
Yes same start in dxf file for me. Also 1115 lines of code.
Is there any place to get an older version of GearBakery?
Regards
//Ronny
I found the issue, I will have an update in an hour or so.
@Doug
Is there any chance to put in Module (pitch diameter / nr teeth) to specify gears?
Now I calculate it to Circular Pitch, for Module 1 this will be 3,14. Here in input it´s only possible to specify 2 decimal, I would prefer a little more, maybe 4 decimal.
Good work!
Regards
//Ronny
I'm not sure what you are asking for. I added more digits to the input box.
I posted 3.05 as a replacement executable. Link is right below 3.04 download link.
Thank you, Doug. It all seems to work well now.
Are you going to include it in a complete 3.05 package?
Thanks Doug!
It worked ok now!
Here in Sweden we use metric system, so it´s common to specify gear attributes in the Module system. Sure it´s possible to recalculate to Module -> Circular Pitch, and now with more decimals I got closer to metric system :-)
Here is some info: https://en.wikipedia.org/wiki/Gear
And near the end the header "Standard pitches and the module system" describe the Module.
Standard module values are 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.25, 1.5, 2.0, 2.5, 3, 4, 5, 6, 8, 10, 12, 16, 20, 25, 32, 40 and 50.
Maybe it could be as simple as a drop down with these standards and when selected it updates Circular Pitch input field?
Best regards!
//Ronny
@Tony. Posted complete 3.05 package
@Ronny. I will have a look at the module system. I will also look into supporting the metric system as well. It may be a while before I can get to these.
I really wish you could edit comments.
Thanks! I needed to 3d print some gears for a project for college and it was hard to find a tool to easily create them. This really helped.
@zzaio
Cool! Can you post some pics?
@Doug Rogers
Sure, here are some of the gears I printed and a quick test-assembly to see
if it works (it's just a testing frame, it's going to look nicer eventually).
It's still a work in progress. It would take too long to describe what it's
for but basically I need to move the wheel on that metal rod using a stepper motor.
https://imgur.com/a/YyRyubf
I just downloaded GearBakery. When I tried to run it, I got an error message, "VCRUNTIME140_1.dll was not found". What is the fix for this?
Thank you!
Install the Visual Studio redistributable:
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
great job! thank you to share such a great application. i have only one problem. default line of gears are black. it cause problem for those used to use a black workspace on CAD.
I wish one day you do same job for cycloidal code of Dr. hessmer.
is it possible for you to preapre such an application?
It will probably be next year until I get time to work on this. The cycloidal gear should not take too long to add to the GearBakery.
hi Doug
I was waiting to see cycloidal gear is added to your great project.
wish some day it happen and your great app becomes the most complete gear making application.
best
Hi dough
I interested in cycloidal gears and wish to have the program as a stand alone program. Two last post are mine 😊
I've hoped you can repeat your great job for cycloidal gears too.
But it seems you are too busy 😉
Can you help me to make it by my own?
I'm not a programmer but have hope to paste the code from page to excitable code.
I am sorry, but I am really swamped right now. I don't think I can do this in the foreseeable future. You will need to have the help of a programmer for this.
Oh no, it's your kindness to share such great application for free. I just hope you can do same for cycloidal one. I don't want to make you to do that.
Can you tell me how to approach the application, some of my friends are professional programmer, they might can write the application.
Is that possible to use the zipped files to find the right way?
The original source code from Dr. Rainer Hessmer can be found here:
http://hessmer.org/gears/InvoluteSpurGearBuilder.html
I mean source code in C++ you prepared.
I searched and found that it's not that easy to find codes from .exe or .dll files.
Is that possible for you to share that?
Post a Comment