Version 2 creates higher quality output without ragged edges at higher speed. Like before, undercuts as needed for small tooth counts are correctly handled; clearance, backlash, and profile shift are fully supported.
As an extreme case the image on the left shows a 12 tooth gear meshing with a 5 tooth pinion (tool link). Notice the extent of the undercut. The image on the right (tool link) shows the same gears but this time with profile shift applied. The profile shift considerably strengthens the pinion gear teeth.
The key differences of v2 compared to v1 are:
Modern SVG output
Higher quality output (no ragged edges) without excessive segment counts. No more need to fiddle with quality parameters.
Significantly faster than v1 at any acceptable quality levels
Parameters are automatically injected in the URL; i.e., the URL fully specifies the output and can be shared with others.
Corrected internal gear generation (e.g., clearance is properly applied)
In case you are interested in how the gear shapes are created, the first post that introduced version 1 is a good start. Then this pdf document provides more detail about how v2 accomplishes the smooth curves that v1 struggled with. Internal gears are particularly challenging in this regard. Here is just a teaser:
UPDATE: This post refers to an old version. For information about version 2 see this post.
Before you read on, please make sure that you have seen part 1 which introduces my Online Involute Spur Gear Builder. This second part addresses DXF export and compares the generated tooth profiles with the output from a commonly used OpenScad script.
Unfortunately there are many variants of the DXF format and not every tool is capable of importing the dxf output generated by the tool. Here are a few pointers:
Inkscape: Inkscape is a free, open source vector graphics tool that can import the generated dxf output without any issues. Inkscape’s native format is svg but it also supports many other output formats that are useful when dealing with other tools.
Illustrator and VectorWorks do not seem to recognize the generated output. Lael and Jeroen Donker reported workarounds (thank you, both!):
Lael: Just an update for anyone else trying to use illustrator or having issues importing into drawing programs. I downloaded Dassault draftsight, opened the dxf generated by this generator, then saved it as 2009, 2010 and 2013 dxf. 2009 and 2010 opened fine in illustrator.
Jeroen Donker: I found that the dxf output file can be opened in Inkscape (freeware on all platforms) and then saved in any vector format (I use eps) Opening the file in Adobe Illustrator is an easy next step.
Generated Output Comparison
It is interesting to compare the generated output with that of other tools. In particular this makes it quite easy to see when the undercuts become relevant. For the following I used Leemon Baird’s featured Public Domain Involute Parameterized Gears for OpenScad. Upfront I want to clearly state that this comparison by no means is intended to diminish Leemon Baird’s code. Like many other tools it simply does not cater for undercuts which in most real-world scenarios can be ignored. If undercuts are not an issue Leemon Baird’s tool is a perfect choice.
For the comparison I chose a pressure angle of 20°, 8 mm circular pitch, no clearance, and no backlash. For reference here is the scad file with the configuration for the 6 tooth gear and the resulting dxf file generated by Leemon Baird’s script.
The images below (excerpts from the svg file InvoluteGearComparison.svg) show the tooth profiles for tooth count 40, 20, 10, and 6. The thicker black background lines represent the output generated by Leemon Baird’s code. The thinner red lines in the foreground are the tooth profiles generated by my online generator:
As expected the two profiles match almost exactly for large tooth counts. It is interesting to see that even for a tooth count of 20 there is a slight undercut visible. I expect in real live this would not matter since it is compensated for by a non-zero backlash.
The code behind the online involute spur gear builder determines the tooth profile by simulating how a gear with infinite radius (aka rack) would cut into a smaller gear as discussed by Michal Zalewki. The advantage of the infinite gear is that it has a very simple trapezoidal tooth form solely defined by the addendum height and the pressure angle. In the figure below the rack is shown at the top. When the rack is moved to the right the gear needs to rotate clockwise so that a point on the pitch circle of the gear moves with the same speed as the rack. The code simulates this movement in steps and then for each step subtracts the shape of the rack from the gear.
For illustration purposes the figure below has been calculated based on very coarse steps and only shows two teeth of the rack.
In reality the code simulates only one rack tooth and calculates the tooth profile of half a tooth of the matching gear. The complete gear is then assembled by mirroring and rotating the half tooth. All of this is accomplished by leveraging the ‘Constructive Area Construction’ capabilities of the csg.js library which is part of OpenJsCad. Each rack tooth location is calculated and created as a polygon. These polygons are joined together with the union operator to form one complex 2d shape that is then subtracted from a slice of the outer circle of the target gear to form half a tooth. Finally, the complete gear is assembled from rotated and mirrored half teeth:
The graphic above shows rough steps in the final output. This can be somewhat alleviated by using finer steps in the simulation but to really get rid of the steps additional smoothing is required. The step profile occurs in the undercut regions where the backside of the rotated rack tooth profile sticks out as a corner. The smoothing logic is explained in this diagram:
The final result has smooth tooth profiles. As an example below is an image of a calculated gear set (pressure angle 14.5°) consisting of a 30 tooth gear meshing with an 8 tooth gear. Small values for clearance and backlash were used. Head over to the involute spur gear builder page to try it out yourself.
Please see part two for more information about dxf output and how the output compares with that from other tools.
Split the Quality parameter into two parts to provide better control over the desired quality of the generated output: