Ball bearings¶
⚙️ Spec sheet → — visual schematic and metrics measured from a real rendered STL.
Pure-Python port of BOSL2’s ball_bearings.scad: models of standard ball-bearing cartridges.
ball_bearing() builds one from a trade-size name or explicit
dimensions; ball_bearing_info() returns the tabulated
dimensions as a ball_bearings.
- class pybosl2.parts.ball_bearings.BearingSpec(inner_diameter, outer_diameter, width, shielded)[source]¶
Bases:
objectTabulated dimensions of a standard ball-bearing cartridge.
Returned by
BallBearings.ball_bearing_info()when looking up aBearingTypetrade size.- inner_diameter : float¶
- outer_diameter : float¶
- width : float¶
- shielded : bool¶
- class pybosl2.parts.ball_bearings.BallBearings[source]¶
Bases:
objectModels of standard ball-bearing cartridges.
Port of BOSL2’s
ball_bearings.scad. Builds sealed/shielded or open bearings from a trade size or explicit dimensions.See also
Visual spec sheet — measurements and STL previews
- static ball_bearing_info(trade_size)[source]¶
Look up the tabulated dimensions for a trade-size bearing.
Accepts a string name (
"608","6902ZZ") or aBearingTypeenum value, and returns the correspondingBearingSpec.- Parameters:¶
- trade_size : str | BearingType¶
The bearing trade size as a string (e.g.
"608"or"R8ZZ") or aBearingTypeenum value.
- Returns:¶
A
BearingSpecwith the inner_diameter, outer_diameter, width, and shielded flag.- Raises:¶
ValueError – If the trade size is not found in the bearing table.
- Return type:¶
-
static ball_bearing(trade_size=
None, inner_diameter=None, outer_diameter=None, width=None, shield=True, color=None, fn=None, fa=None, fs=None)[source]¶ Build a standard ball-bearing cartridge model.
Give a trade_size name (or
BearingType), or explicit inner_diameter/outer_diameter/width (with shield). Returns aBosl2Solidcentered on the origin.- Parameters:¶
- trade_size : str | BearingType | None¶
The bearing trade size as a string or
BearingType. Overrides explicit dimensions if given.- inner_diameter : float | None¶
Inner (shaft) diameter in mm. Required if trade_size is not given.
- outer_diameter : float | None¶
Outer diameter in mm. Required if trade_size is not given.
- width : float | None¶
Axial width in mm. Required if trade_size is not given.
- shield : bool¶
Model sealed/shielded cartridge (True) or open bearing with balls (False). Defaults to True.
- color : Color | None¶
Color name to apply to the bearing model. Defaults to “silver”.
- fn : int | None¶
Number of fragments for cylinder resolution. Passed to the geometry primitives.
- fa : float | None¶
Minimum fragment angle. Passed to the geometry primitives.
- fs : float | None¶
Minimum fragment size. Passed to the geometry primitives.
- Returns:¶
A ball-bearing cartridge as a
Bosl2Solid.- Raises:¶
ValueError – If inner_diameter, outer_diameter, or width are not provided and trade_size is not given.
- Return type:¶
CsgSolid
Examples
A common 608 skate bearing:
from pybosl2.parts.ball_bearings import BearingType, BallBearings BallBearings.ball_bearing(BearingType.BEARING_608).show()Loading 3-D preview…
Examples¶
These mirror the examples in BOSL2’s ball_bearings.scad, rendered live through PythonSCAD.
Examples that rely on BOSL2’s attachment/anchor system, or on features not in this port, are omitted.
ball_bearing
A 608 skate bearing:
from pybosl2.parts.ball_bearings import BallBearings
BallBearings.ball_bearing("608").show()
A shielded 608ZZ:
from pybosl2.parts.ball_bearings import BallBearings
BallBearings.ball_bearing("608ZZ").show()
An R8 imperial bearing:
from pybosl2.parts.ball_bearings import BallBearings
BallBearings.ball_bearing("R8").show()
A custom open bearing by dimensions:
from pybosl2.parts.ball_bearings import BallBearings
BallBearings.ball_bearing(inner_diameter=12, outer_diameter=32, width=10, shield=False).show()