Gears#
Recognize spur and helical gears, external and internal, and read the parameters they are specified with.
Note
Prerequisites: Attributed Adjacency Graph (AAG)
Gear Recognition#
GearShapeRecognizer reads a gear from its faces: a ring of identical involute teeth about an axis, and the body
that carries them. It reads spur and helical gears, external and internal, and gives back a GearShape holding the
parameters a gear is specified with. A part that is not a gear is refused, with the reason.
Quick Start#
import gzip
from io import BytesIO
from volmdlr import shapes
from volmdlr_tools.shapes.recognizers import GearShapeRecognizer
def load(path):
with open(path, "rb") as file:
return shapes.Solid.from_brep(BytesIO(gzip.decompress(file.read())))
recognizer = GearShapeRecognizer(shape=load("data/gear/alpha_25.brep.gz"))
gear = recognizer.result
print(gear.tooth_count, round(gear.module, 6), gear.pressure_angle, gear.internal, gear.hand)
# 20 2.0 25.0 False None
print(round(gear.tip_radius, 6), round(gear.root_radius, 6), round(gear.pitch_radius, 6), gear.face_width)
# 22.0 17.5 20.0 6.0
print(gear.axis_direction, len(gear.tooth_face_ids), len(gear.body_face_ids))
# Vector3D(0.0, 0.0, 1.0) 120 2

alpha_25.brep.gz as read: the 120 tooth faces (tooth_face_ids) in blue, the two body faces (body_face_ids),
its flat ends, in sand.
GearShapeRecognizer#
GearShapeRecognizer(
shape: Union[shapes.Shell, shapes.Solid],
aag: Optional[AttributedAdjacencyGraph] = None,
linear_tolerance: Optional[float] = None,
name: str = "",
)
shape: the part to read.aag: a face adjacency graph of the part, when you already have one.linear_tolerance: the tolerance on lengths; it defaults to a small share of the part’s size.
Member |
Description |
|---|---|
|
Read the part; |
|
The |
|
Why the part is not a gear, as a |
Reading result or refusal runs the recognition the first time.
When the part is not a gear#
NotAGear is a FaceRefusal: it carries a reason, the face_ids it is about (empty when it is about the whole
part) and, when known, their area. A part with a ring of identical faces about an axis is not a gear unless those
faces are teeth with mirrored flanks:
recognizer = GearShapeRecognizer(shape=load("data/gear/polygon_prism.brep.gz"))
print(recognizer.result)
# None
print(recognizer.refusal.reason)
# no two mirrored classes of flank faces repeat round the axis
What a GearShape holds#
Lengths are in the part’s units and angles in degrees. Angles about the axis are measured from
reference_direction, positive by the right hand about the axis direction.
Attribute |
Description |
|---|---|
|
The point of the axis level with the end of the teeth the axis direction leaves from |
|
The unit axis direction |
|
The number of teeth |
|
The pitch diameter divided by the tooth count |
|
The angle of the flanks to the radius at the pitch circle, rounded to a standard value (14.5°, 20°, 22.5° or 25°) when it lies within half a degree of one |
|
The pressure angle the flanks show, before it is rounded |
|
The tip and root circles; the tip circle lies inside the root circle on an internal gear |
|
The length of the teeth along the axis |
|
Whether the teeth point at the axis |
|
The angle of the teeth to the axis at the pitch circle; |
|
|
|
The angle of the tooth centre nearest the reference direction at the start of the face width |
|
The radius of the blend between flank and root, and between flank and tip; |
|
The chamfers on the tooth tips at either end, as |
|
The faces of the teeth |
|
The other faces of the part |
|
The body carrying the teeth, read as a turned body ( |
Derived values: pitch_radius, addendum (pitch circle to tip circle), dedendum (pitch circle to root circle),
base_radius and reference_direction. validate() checks that the parameters describe a gear, and
extract_features() returns them as a dictionary, the body under "body".
Building the teeth again#
teeth_code(length_scale=1000.0, tip_fillet=False) returns Python source that builds the teeth with a gear library,
placed and turned as they are in the part. The code binds teeth: the gear itself for an external gear, and the
toothed band between the tip and root circles for an internal one. What the call does not build, such as a blend, a
tip chamfer or the helix of an internal gear, is written in the code as a comment rather than dropped.
length_scale turns the part’s lengths into the code’s; the default turns metres into millimetres, so pass 1.0 for
a part that is already in millimetres. tip_fillet=True passes the tip blend to the library instead of writing it as
a comment.
Limitations#
Only spur and helical gears are read: the teeth must be involute, identical and evenly spaced all the way round the axis.
The code
teeth_code()writes builds an internal gear as a straight band; its helix is written as a comment.
See Also#
Turned Parts - Reading a part as a turned profile with features
AAG (Attributed Adjacency Graph) - Understanding the graph representation
See Also#
Turned Parts - Turned parts
Swept Shapes - Swept shape recognition