Skip to content

[BUG] worm_gear(): backlash parameter has no effect — not passed to _gear_tooth_profile() #1902

@chertykov

Description

@chertykov

Describe the bug
The backlash parameter in worm_gear() is accepted, validated via assert, but never forwarded to the internal _gear_tooth_profile() call. As a result, _gear_tooth_profile() always uses its default value backlash=0.0, and the gear tooth geometry is identical regardless of what backlash value the user specifies.

Code To Reproduce Bug

include <BOSL2/std.scad>
include <BOSL2/gears.scad>

// Render these side by side — they produce identical geometry
up(4) worm_gear(mod=0.8, teeth=120, worm_diam=14, worm_starts=1, worm_arc=60, backlash=0.0, slices=30, $fn=60);
down(4) worm_gear(mod=0.8, teeth=120, worm_diam=14, worm_starts=1, worm_arc=60, backlash=1.0, slices=30, $fn=60);

Expected behavior
backlash=1.0 should produce noticeably thinner teeth compared to backlash=0.0, creating clearance between meshing teeth — consistent with how backlash works in spur_gear(), rack(), and other gear modules.

Screenshots

Image

Actual Behavior
Both models are identical. Changing backlash from 0 to any value has zero visual or geometric effect.

Root Cause
In gears.scad, inside the worm_gear() function body, the call to _gear_tooth_profile() is missing the backlash argument:

// gears.scad, inside function worm_gear(), approximately line 2188
full_tooth = path3d(reverse(zrot(90, _gear_tooth_profile(
                                         circ_pitch, teeth=teeth,
                                         pressure_angle=PA,
                                         profile_shift=profile_shift,
                                         clearance=clearance, shorten=.3,
                                         helical=helical, internal=false,
                                         // backlash is NOT passed here
                                         center=true)))),

Suggested Fix
Add backlash=backlash to the _gear_tooth_profile() call:

 full_tooth = path3d(reverse(zrot(90, _gear_tooth_profile(
                                          circ_pitch, teeth=teeth,
                                          pressure_angle=PA,
                                          profile_shift=profile_shift,
                                          clearance=clearance, shorten=.3,
+                                         backlash=backlash,
                                          helical=helical, internal=false,
                                          center=true)))),

Version
OpenSCAD version 2021.01

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions