Hinges

⚙️ Spec sheet →  —  visual schematic and metrics measured from a real rendered STL.

Pure-Python port of the hinges in BOSL2’s hinges.scad: a print-in-place LivingHingeMask (differenced from a plate to make a folding “live” hinge), a functional interlocking KnuckleHinge leaf (with KnuckleHingePair for both leaves meshed around one pin, at any fold angle), and simple SnapLock / SnapSocket connectors.

class pybosl2.parts.hinges.KnuckleHinge(length=40, segs=5, knuckle_diam=6, pin_diam=2, arm=20, thick=3, gap=0.4, inner=False, fn=None, fa=None, fs=None)[source]

Bases: object

One leaf of an interlocking knuckle hinge with a pin bore.

The hinge pin lies along X at the origin; the flat leaf extends in +Y (outer leaf) or -Y (inner leaf). segs is the total knuckle count across both leaves — the outer leaf takes the ceil(segs/2) even knuckles, the inner leaf the floor(segs/2) odd ones. Pair with KnuckleHingePair.

Examples

An outer knuckle hinge leaf:

from pybosl2.parts.hinges import KnuckleHinge
KnuckleHinge().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
length : float

segs : int

knuckle_diam : float

pin_diam : float

arm : float

thick : float

gap : float

inner : bool

fn : int | None

fa : float | None

fs : float | None

property length : float

Hinge length in mm.

property arm : float

Leaf arm length in mm.

property inner : bool

True for the inner leaf, False for outer.

shape()[source]

Return the knuckle hinge leaf geometry.

Return type:

CsgSolid

show()[source]

Display the knuckle hinge leaf in the viewer.

Return type:

None

class pybosl2.parts.hinges.KnuckleHingePair(length=40, segs=5, knuckle_diam=6, pin_diam=2, arm=20, thick=3, gap=0.4, fold=0, pin=True, fn=None, fa=None, fs=None)[source]

Bases: object

Both leaves of a knuckle hinge, meshed around one pin.

Set fold to rotate the inner leaf about the pin axis. With pin, a pin cylinder is included.

Examples

A knuckle hinge folded 90 degrees:

from pybosl2.parts.hinges import KnuckleHingePair
KnuckleHingePair(fold=90).show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
length : float

segs : int

knuckle_diam : float

pin_diam : float

arm : float

thick : float

gap : float

fold : float

pin : bool

fn : int | None

fa : float | None

fs : float | None

property length : float

Hinge length in mm.

property fold : float

Fold angle in degrees.

shape()[source]

Return the hinge pair geometry.

Return type:

CsgSolid

show()[source]

Display the hinge pair in the viewer.

Return type:

None

class pybosl2.parts.hinges.LivingHingeMask(length, thick, layerheight=0.2, foldangle=90, hingegap=None, slop=0.0)[source]

Bases: object

A wedge mask to difference out of a plate to make a print-in-place living hinge.

Centre it on the bottom of a plate of thickness thick; it leaves 2*layerheight of material as the flexible hinge, and a V-groove wide enough to fold foldangle degrees.

Examples

A living hinge cut into a 100x40 plate:

from pybosl2.parts.hinges import LivingHingeMask
from pybosl2.solid import cuboid
(cuboid([100, 40, 3]) - LivingHingeMask(length=100, thick=3, foldangle=60).shape().down(1.5)).show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
length : float

thick : float

layerheight : float

foldangle : float

hingegap : float | None

slop : float

property length : float

Hinge length in mm.

property thick : float

Plate thickness in mm.

shape()[source]

Return the hinge mask geometry.

Return type:

CsgSolid

show()[source]

Display the hinge mask in the viewer.

Return type:

None

class pybosl2.parts.hinges.SnapLock(thick=3, snaplen=5, snapdiam=5, layerheight=0.2, foldangle=90, hingegap=None, slop=0.0, fn=None, fa=None, fs=None)[source]

Bases: object

A snap-lock tab (a ridge on a post) that clicks into a SnapSocket.

Examples

A snap-lock tab:

from pybosl2.parts.hinges import SnapLock
SnapLock().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
thick : float

snaplen : float

snapdiam : float

layerheight : float

foldangle : float

hingegap : float | None

slop : float

fn : int | None

fa : float | None

fs : float | None

property thick : float

Plate thickness in mm.

shape()[source]

Return the snap-lock tab geometry.

Return type:

CsgSolid

show()[source]

Display the snap-lock tab in the viewer.

Return type:

None

class pybosl2.parts.hinges.SnapSocket(thick=3, snaplen=5, snapdiam=5, layerheight=0.2, foldangle=90, hingegap=None, slop=0.0, fn=None, fa=None, fs=None)[source]

Bases: object

The receiving socket for a SnapLock tab.

Examples

A snap socket:

from pybosl2.parts.hinges import SnapSocket
SnapSocket().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
thick : float

snaplen : float

snapdiam : float

layerheight : float

foldangle : float

hingegap : float | None

slop : float

fn : int | None

fa : float | None

fs : float | None

property thick : float

Plate thickness in mm.

shape()[source]

Return the snap socket geometry.

Return type:

CsgSolid

show()[source]

Display the snap socket in the viewer.

Return type:

None

Examples

These mirror the examples in BOSL2’s hinges.scad, rendered live through PythonSCAD. Examples that rely on BOSL2’s attachment/anchor system, or on features not in this port, are omitted.

knuckle_hinge

A 5-knuckle hinge leaf:

from pybosl2.parts.hinges import KnuckleHinge
KnuckleHinge(length=35, segs=5).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

knuckle_hinge_pair

A meshed hinge pair:

from pybosl2.parts.hinges import KnuckleHingePair
KnuckleHingePair(length=40, segs=5).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

living_hinge_mask

A living-hinge groove mask:

from pybosl2.parts.hinges import LivingHingeMask
LivingHingeMask(length=100, thick=3, foldangle=60).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

snap_lock

A snap lock:

from pybosl2.parts.hinges import SnapLock
SnapLock(thick=3, foldangle=60).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

snap_socket

A snap socket:

from pybosl2.parts.hinges import SnapSocket
SnapSocket(thick=3, foldangle=60).shape().show()
Loading 3-D preview…

⬇ Download STL mesh