gear - generation of gears, racks, etc¶
This module provide functions to generate racks and gears with many different shapes.
The mainstream gears are involute gears (using involute of circles as contact curves). This is due to the standard shape of racks. And involute gears are the best choice for most designs, which is why the current implementation focusses on them.
However the tools here are modular, which means you can combine them with your own functions to create customized gears.
Examples
As a first use, you may want to generate a fully finished spur gear If you do not specify optional arguments, the function will provide good defaults for it.
>>> # fully featured gear
>>> gear(step=3, z=12, depth=4, bore_radius=1.5)
You may want to generate a more bizarre gear, with a a different hub for instance. You will then need to assemble a gear from its 3 components: exterior (tooths), structure (between hub and exterior), and hub (what holds the gear on an axis)
>>> # this assemble a gear specifying each independant sub-parts
>>> ext_radius = (3*12)/(2*pi) - 3
>>> int_radius = 4
>>> geargather(
... gearexterior(repeat_circular(gearprofile(3, 30), 30), depth=4),
... gearstructure('rounded', ext_radius, int_radius, 2, patterns=6),
... my_hub_mesh,
... )
For reuse in your custom functions, the functions used to generate the gears are exposed:
>>> # this is the raw profile of a tooth
>>> gearprofile(step=3, z=12)
tooth profiles generation¶
The following functions are focussing on involute gears. If you want more details on how involutes gears are defined and computed, you can take a look at the algorithm section
- rackprofile(step, h=None, offset=0, alpha=0.3490658503988659, resolution=None) madcad.mesh.Wire ¶
Generate a 1-period tooth profile for a rack
- Parameters
step – period length over the primitive line
h – tooth half height
offset – rack reference line offset with the primitive line (as a distance) - the primitive line is the adherence line with gears - the reference line is the line half the tooth is above and half below
alpha – angle of the tooth sides, a.k.a pressure angle of the contact
- gearprofile(step, z, h=None, offset=0, alpha=0.3490658503988659, resolution=None, **kwargs) madcad.mesh.Wire ¶
Generate a 1-period tooth profile for a straight gear
- Parameters
step – period length over the primitive circle
z – number of tooth on the gear this profile is meant for
h – tooth half height
offset – offset distance of the matching rack profile (see above)
alpha – pressure angle in the contact
The result is the following curve (the white one):
gear generation¶
- gear(step, z: int, depth, bore_radius=0, int_height=0, pattern='full', **kwargs) madcad.mesh.Mesh ¶
Generate a pinion.
Any extra argument will go to functions
gearprofile
,gearstructure
, orgearhub
- Parameters
step (float) – tooth step over the primitive curve, same as the matching rack step the primitive perimeter is
step * z
and radius isstep * z / 2*pi
z (int) – number of teeth
depth (float) – extrusion eight - width of the gear along its axis
bore_radius (float) – radius of the main bore
int_height (float) – if you want a pinion with a structure thinner than the value of
depth
, the total height will betotal_height = depth - 2 * int_height
pattern – determine the structure between exterior (tooth) and hub This argument specifies the use a a function named
'pattern_'+pattern
in this module.
Extra parameters for
gearprofile
offset (float): offset of tooth (as a distance) alpha (float): pressure angle in radian
Extra parameters for
gearexterior
helix_angle (float): helix angle to get a helical pinion in radian chamfer (float): chamfer angle - only for straight pinion
Extra parameters for
gearstructure
ratio (float): influence the proportion of dimensions of the structure
Note:
int_height
impacts the thickness of the structure unless specifiedExtra parameters for
gearhub
hub_height (float): height of the hub shoulder
Note
int_height
impacts the height of the hub unless specified.if
hub_height
is null, there will be no hub.
a simple use:
>>> gear(3, 12, 4, bore_radius=1.5)
a more advanced use:
>>> gear(3, 30, 4, bore_radius=2, pattern='rounded', patterns=6, int_height=1, chamfer=radians(20))
- geargather(exterior, structure, hub) madcad.mesh.Mesh ¶
Gather all parts: exterior, structure, and hub
You can obtain them via the provided functions, or generate them yourself.
- gearexterior(profile: madcad.mesh.Wire, depth, step=None, helix_angle=0, chamfer=0, **kwargs) madcad.mesh.Mesh ¶
Generate the external part of the pinion
- Parameters
profile (Web) – profile of the pinion generated by
gearprofile
depth (float) – extrusion eight - width of the gear along its axis
step (float) – step of chordal pitch, must be specified for non-null helix_angle, unused otherwise
helix_angle (float) – helix angle for helical gears - only without bevel;
bevel
= False - it must be a radian anglechamfer (float) – chamfer angle - only for straight pinion
- gearstructure(pattern, ext_radius, int_radius, depth, int_height=0, ratio=1, **kwargs) madcad.mesh.Mesh ¶
Generate the internal part of the pinion
- Parameters
ext_radius (float) – given by the attribut
_radius
of the result ofrepeat_circular
- to avoid interference, it must be smaller than_radius
(for instance 0.95 *_radius
))int_radius (float) – it is the same radius of the largest radius of the hub part
depth (float) – face width
pattern – any of ‘full’, ‘circle’, ‘rect’, ‘rounded’
int_height (float) – if you want a pinion with a structure thinner than the value of
depth
, the total height will betotal_height = depth - 2 * int_height
- gearhub(bore_radius, depth, int_height=0, hub_height=None, hub_radius=None, **kwargs) madcad.mesh.Web ¶
Generate a hub for a pinion part
- Parameters
bore_radius (float) – radius of the central bore
depth (float) – face width; same parameter for
gearexterior
andgearstructure
int_height (float) – only useful for no hub case, checkout the function
gearstructure
for more informationhub_height (float) – height of the hub
hub_radius (float) – external radius of the hub
Note
if
bore_radius
is null, the function will return a top circle and a bottom circle used forgeargather
functionif
hub_height
is null, the function will return a structure with a bore and without a hub
helper tools¶
- gearcircles(step, z, h=None, offset=0, alpha=0.5235987755982988)¶
return the convenient circles radius for a gear with the given parameters return is
(primitive, base, bottom, top)
- involute(c, t0, t)¶
give a point of parameter
t
on involute from circle or radiusc
, starting fromt0
on the circlet
andt0
are angular positions
- involuteat(c, r)¶
give the parameter for the involute of circle radius
c
to reach radiusr
- involuteof(c, t0, d, t)¶
give a point of parameter
t
on involute with offset, from circle or radiusc
, starting fromt0
on the circlet
andt0
are angular positions
- repeat_circular(profile, n: int) madcad.mesh.Wire ¶
Repeat n times the given Wire by rotation around (O,Z)
structure patterns¶
Those are the functions generating usual structures ready to used in geargather
.
- pattern_circle(ext_radius, int_radius, depth, int_height=0, ratio=1, patterns: int = 5, circles_radius=None, circles_place=None, **kwargs) madcad.mesh.Mesh ¶
Generate two parts of the structure (the top and the bottom) with
patterns
distributed on the whole structure.Return a tuple (Web, Web, Mesh) where the first
Web
is the top of the structure, the secondWeb
is the bottom of the structure and the last elementMesh
is all side surfaces.- Parameters
ext_radius (float) – radius of the external border of the structure
int_radius (float) – radius of the internal border of the structure
depth (float) – face width
int_height (float) – if you want a pinion with a structure thinner than the value of
depth
, the total height will betotal_height = depth - 2 * int_height
ratio (float) – number that allows to change proportionally the radius of circles
patterns (int) – number of circles of the structure
circles_radius (float) – radius of circles
circles_place (float) – radius where the origins of circles are placed
Note
for instance, with a ratio of 1.5, the radius of circles
circles_radius
will be divided by 1.5if
circles_radius
is chosen,ratio
won’t impact the radius of circlescircles_radius
- pattern_full(ext_radius, int_radius, depth, int_height=0, **kwargs) madcad.mesh.Mesh ¶
Generate two full parts of the structure (the top and the bottom).
Return a tuple (Web, Web, None) where the first
Web
is the top of the structure and the secondWeb
is the bottom of the structure.- Parameters
ext_radius (float) – float (radius of the external border of the pattern
int_radius (float) – radius of the internal border of the pattern
depth (float) – face width
int_height (float) – if you want a pinion with a structure thinner than the value of
depth
, the total height will betotal_height = depth - 2 * int_height
- pattern_rect(ext_radius, int_radius, depth, int_height=0, ratio=1, patterns=5, ext_thickness=None, int_thickness=None, **kwargs) madcad.mesh.Mesh ¶
Generate two parts of the structure (the top and the bottom) with
patterns
distributed on the whole structure. All corners are straight. Check the functionpattern_rounded
to get rounded corners.Return a tuple (Web, Web, Mesh) where the first
Web
is the top of the structure, the secondWeb
is the bottom of the structure and the last elementMesh
is all side surfaces.- Parameters
ext_radius – float (radius of the external border of the structure)
int_radius – float (radius of the internal border of the structure)
depth – float (face width)
int_height – float (if you want a pinion with a structure thinner than the value of
depth
, the total height will betotal_height = depth - 2 * int_height
)ratio – float (it is a number which is the proportional factor for an homothety of patterns)
patterns – int (number of patterns inside the structure)
ext_thickness (float) – internal radius of the pattern
int_thickness (float) – external radius of the pattern
Note
for instance, if
ratio
is 1.5, the area of the pattern will be divided by 1.5.if
r_int
andr_ext
are chosen,ratio
won’t impact these parameters
- pattern_rounded(ext_radius, int_radius, depth, int_height=0, ratio=1, patterns: int = 5, ext_thickness=None, int_thickness=None, **kwargs) madcad.mesh.Mesh ¶
Generate two parts of the structure (the top and the bottom) with
patterns
distributed on the whole structure. All corners are rounded. Check the functionpattern_rect
to get straight corners.Return a tuple (Web, Web, Mesh) where the first
Web
is the top of the structure, the secondWeb
is the bottom of the structure and the last elementMesh
is all side surfaces.- Parameters
ext_radius – float (radius of the external border of the structure)
int_radius – float (radius of the internal border of the structure)
depth – float (face width)
int_height – float (if you want a pinion with a structure thinner than the value of
depth
, the total height will betotal_height = depth - 2 * int_height
)ratio – float (it is a number which is the proportional factor for an homothety of patterns)
patterns – int (number of patterns inside the structure)
ext_thickness (float) – internal radius of the pattern
int_thickness (float) – external radius of the pattern
Note
for instance, if
ratio
is 1.5, the area of the pattern will be divided by 1.5.if
r_int
andr_ext
are chosen,ratio
won’t impact these parameters