o_rings - parametric O-rings

O-rings are toroidal elastomeric seals installed in a gland and compressed between mating components to prevent fluid or gas leakage. The o_rings module creates nominal O-ring geometry and provides profiles for corresponding static and dynamic glands.

The O-ring dimensions are the general-industrial Class A dimensions from ISO 3601-1. Gland dimensions are initial design recommendations from the Apple Rubber Seal Design Guide and have not been verified against ISO 3601-2.

O-rings of different widths

Creating O-Rings

An O-ring is selected by its three-digit ISO 3601 size code. A leading hyphen and omitted leading zeroes are accepted and normalized:

from bd_warehouse.o_rings import ORing

seal = ORing("025")
equivalent_seal = ORing("-25")

The generated torus uses the nominal inside diameter and cross-section diameter. Dimensional tolerances are available as attributes but are not applied to the CAD geometry.

class ORing(size: str, o_ring_type: str = 'iso3601', rotation: ~build123d.geometry.Rotation | tuple[float, float, float] = (0, 0, 0), align: None | ~build123d.build_enums.Align | tuple[~build123d.build_enums.Align, ~build123d.build_enums.Align, ~build123d.build_enums.Align] = None, mode: ~build123d.build_enums.Mode = <Mode.ADD>)[source]

Parametric O-ring for static and dynamic sealing applications.

O-rings are toroidal elastomeric seals installed in a gland and compressed between mating components to prevent fluid or gas leakage. This class creates nominal general-industrial Class A geometry from ISO 3601-1 and provides static_gland_profile() and dynamic_gland_profile() helpers for designing a corresponding gland. The gland dimensions are initial design recommendations from the Apple Rubber Seal Design Guide; they have not been verified against ISO 3601-2.

Parameters:
  • size – Three-digit O-ring size code, such as "025". A leading hyphen and omitted leading zeroes are accepted and normalized.

  • o_ring_type – Dimensional standard used to interpret size. Defaults to "iso3601".

  • rotation – Sequence of angles about the X, Y, and Z axes. Defaults to (0, 0, 0).

  • align – Align MIN, CENTER, or MAX of the O-ring. Defaults to None.

  • mode – Combination mode. Defaults to Mode.ADD.

Raises:

ValueErrorsize or o_ring_type is invalid.

Size Data

The available standards, size codes, and evaluated dimensions can be inspected without creating geometry:

standards = ORing.types()
sizes = ORing.sizes("iso3601")
dimensions = ORing.parameters("025")
alternatives = ORing.select_by_size("025")

For size 025, parameters returns the nominal inside diameter id, cross-section diameter w, and their symmetric tolerances:

{
    "id": 29.87,
    "w": 1.78,
    "id_tol": 0.28,
    "w_tol": 0.08,
}
classmethod ORing.types() set[str][source]

Return the available O-ring standards.

classmethod ORing.sizes(o_ring_type: str = 'iso3601') list[str][source]

Return the available size codes for an O-ring standard.

classmethod ORing.parameters(size: str, o_ring_type: str = 'iso3601') dict[str, float][source]

Return the evaluated metric parameters for a size and standard.

classmethod ORing.select_by_size(size: str) dict[type[ORing], list[str]][source]

Return the standards that provide the given size code.

classmethod ORing.nominal_widths(o_ring_type: str = 'iso3601') list[float][source]

Return the nominal cross-section widths for an O-ring standard.

Selecting By Diameter

select_by_inner_diameter finds the nearest smaller and larger O-ring in each cross-section family within the requested fractional tolerance:

matches = ORing.select_by_inner_diameter(650)

# {
#     "5.33": ("394", "395"),
#     "6.99": ("474", "475"),
# }

The dictionary keys are cross-section diameters. Each value is a (smaller, larger) pair; an exact match is returned as a one-item tuple.

classmethod ORing.select_by_inner_diameter(inner_diameter: float, tolerance: float = 0.05, o_ring_type: str = 'iso3601') dict[source]

Find closest matches to the given inner_diameter within tolerance. The results are returned in a dict with the key being the O-ring width and the values being a tuple of O-ring size codes in (lower, upper) pairs. Should there be an exact match, a (match,) tuple will be generated.

Parameters:
  • inner_diameter (float) – inner diameter in mm

  • tolerance (float, optional) – ± deviation from target. Defaults to 0.05.

Returns:

width as key and tuple of o-ring dash numbers as values

Return type:

dict

Example

>>> ORing.select_by_inner_diameter(650)
{'5.33': ('394', '395'), '6.99': ('474', '475')}

Selecting By Installed Length

For a non-circular gland or a known piston-groove path, select_by_length finds O-rings by their free centre-line length. A typical piston or male-gland design targets approximately 2% installed stretch. The usual range is 1% to 5%, with 5% treated as an upper limit rather than a target. Rotary shaft seals generally require no installed stretch.

The lower candidate in each result pair will be stretched on the target path. Its installed stretch is:

\[\text{stretch} = \frac{\text{installed length}} {\text{free O-ring length}} - 1\]

For example, size 025 is stretched approximately 2% on a 101.42 mm path:

installed_length = 101.42
matches = ORing.select_by_length(installed_length)
candidate = ORing(matches["1.78"][0])
stretch = installed_length / candidate.length - 1

Stretch reduces the O-ring cross-section, which should be considered when checking gland squeeze and fill.

classmethod ORing.select_by_length(length: float, tolerance: float = 0.05, o_ring_type: str = 'iso3601') dict[source]

Find O-rings for a target installed centre-line length.

For each cross-section family, the result contains the nearest free O-ring lengths below and above length as a (lower, upper) pair. A lower candidate will be stretched when installed on the target path, while an upper candidate will be circumferentially compressed. An exact free-length match is returned as a one-item tuple.

For typical piston or male-gland applications, use about 2% installed stretch as a design target. The usual range is 1% to 5%, with 5% treated as an upper limit rather than a target. Stretch above 5% can accelerate ageing and reduce the O-ring cross-section and resulting seal compression. Rotary shaft seals generally require no installed stretch.

The installed stretch for a candidate is calculated as:

stretch = length / candidate.length - 1

Gland squeeze calculations should account for the reduction in cross-section caused by stretching.

Parameters:
  • length – Target installed centre-line length in millimetres.

  • tolerance – Maximum fractional difference between the free and installed lengths. The default 0.05 searches within 5% of the target.

  • o_ring_type – Dimensional standard used for selection. Defaults to "iso3601".

Returns:

Cross-section widths mapped to lower and upper O-ring size codes.

Example

Select a size for a 101.42 mm installed path and verify that size 025 is stretched by approximately 2%:

>>> installed_length = 101.42
>>> matches = ORing.select_by_length(installed_length)
>>> matches["1.78"]
('025', '026')
>>> candidate = ORing(matches["1.78"][0])
>>> round(installed_length / candidate.length - 1, 3)
0.02

Gland Profiles

The recommended gland width can be queried directly from an O-ring cross-section without constructing an ORing instance. Static and dynamic applications use different tables, and the optional backing-ring count is included in the lookup:

static_width = ORing.gland_width_for(2.62)
dynamic_width = ORing.gland_width_for(
    2.62,
    application="dynamic",
    number_backing_rings=1,
)
classmethod ORing.gland_width_for(o_ring_width: float, application: Literal['static', 'dynamic'] = 'static', number_backing_rings: Literal[0, 1, 2] = 0) float[source]

Return the recommended gland width for an O-ring cross-section.

Parameters:
  • o_ring_width – Nominal O-ring cross-section diameter in millimetres.

  • application"static" or "dynamic" gland design. Defaults to "static".

  • number_backing_rings – Number of anti-extrusion backing rings accommodated by the gland. Defaults to 0.

Returns:

The nominal gland width in millimetres.

Raises:

ValueError – The application, backing-ring count, or O-ring cross-section is invalid or unsupported.

The gland helpers return a build123d Sketch in the XY plane. The gland opening lies on the local X axis and its depth extends in the negative Y direction. The profile can be positioned and used with normal build123d operations to create a linear or revolved gland cutter.

Static Glands

Static glands can be generated for axial or radial squeeze. The optional backing-ring count widens the gland where the published data supports that combination:

seal = ORing("025")
axial_profile = seal.static_gland_profile(axial=True)
radial_profile = seal.static_gland_profile(
    axial=False,
    number_backing_rings=1,
)
ORing.static_gland_profile(axial: bool = True, number_backing_rings: Literal[0, 1, 2] = 0) Sketch[source]

Create the recommended profile for a static O-ring gland.

Parameters:
  • axial – Select axial squeeze when True or radial squeeze when False. Defaults to True.

  • number_backing_rings – Number of anti-extrusion backing rings accommodated by the gland. Defaults to 0.

Returns:

The gland cross-section with its opening on the local X axis.

Raises:

ValueError – The backing-ring count is invalid or unsupported for the O-ring cross-section.

Dynamic Glands

Dynamic profiles are intended for reciprocating or oscillating radial seals. They use less squeeze than static glands to limit friction and wear:

seal = ORing("025")
dynamic_profile = seal.dynamic_gland_profile()
ORing.dynamic_gland_profile(number_backing_rings: Literal[0, 1, 2] = 0) Sketch[source]

Create the recommended profile for a dynamic radial O-ring gland.

The dimensions are intended as initial design guidance for reciprocating or oscillating seals. Dynamic seal performance also depends on material, lubrication, surface finish, pressure, temperature, stretch, and friction.

Parameters:

number_backing_rings – Number of anti-extrusion backing rings accommodated by the gland. Defaults to 0.

Returns:

The gland cross-section with its opening on the local X axis.

Raises:

ValueError – The backing-ring count is invalid or unsupported for the O-ring cross-section.

After either gland method is called, the selected nominal dimensions and tolerances are available through gland_width, gland_width_tol, gland_depth, gland_depth_tol, gland_radius, and gland_radius_tol. Gland design also depends on seal material, hardness, pressure, temperature, lubrication, surface finish, stretch, clearance, and allowable gland fill.