Cube trusses

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

Pure-Python port of BOSL2’s cubetruss.scad: modular cubical truss segments (TrussSegment), trusses assembled from them (Truss, with clips= for end clips), L/T corner trusses (TrussCorner), diagonal supports (TrussSupport), and the printed clip accessories – clip (TrussClip), foot (TrussFoot), joiner (TrussJoiner) and u-clip (TrussUClip). The truss_dist function computes truss length from segment count.

class pybosl2.parts.cubetruss.TrussSegment(size=None, strut=None, bracing=None, fn=None, fa=None, fs=None)[source]

Bases: object

A single cubetruss cube segment — a hollow cube lightened with octagonal tunnels.

Examples

A braced segment:

from pybosl2.parts.cubetruss import TrussSegment
TrussSegment().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
size : float | None

strut : float | None

bracing : bool | None

fn : int | None

fa : float | None

fs : float | None

property size : float

Cube size in mm.

property strut : float

Strut thickness in mm.

shape()[source]

Return the segment geometry.

Return type:

CsgSolid

show()[source]

Display the segment in the viewer.

Return type:

None

class pybosl2.parts.cubetruss.Truss(extents=6, clips=None, bracing=None, size=None, strut=None, clipthick=None, slop=0.0, fn=None, fa=None, fs=None)[source]

Bases: object

A truss assembled from a grid of cube segments.

extents is the number of cubes long, or an [X, Y, Z] count. clips adds end clips on the named faces — each a direction vector FRONT / BACK / LEFT / RIGHT (or a list of them).

Examples

A 3-long truss with a front clip:

from pybosl2.parts.cubetruss import Truss
from pybosl2.constants import FRONT
Truss(extents=3, clips=FRONT).show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
extents : int | Sequence[int]

clips : Sequence[Sequence[float]] | Sequence[float] | None

bracing : bool | None

size : float | None

strut : float | None

clipthick : float | None

slop : float

fn : int | None

fa : float | None

fs : float | None

property extents : int | tuple[int, ...]

Grid dimensions.

shape()[source]

Return the truss geometry.

Return type:

CsgSolid

show()[source]

Display the truss in the viewer.

Return type:

None

class pybosl2.parts.cubetruss.TrussCorner(height=1, extents=1, bracing=None, size=None, strut=None, fn=None, fa=None, fs=None)[source]

Bases: object

A corner truss with arms jutting out in one or more directions.

height is the central column height in cubes. extents is a scalar (equal arms in +X, +Y and +Z) or a length-≤5 vector.

Examples

An L-corner:

from pybosl2.parts.cubetruss import TrussCorner
TrussCorner(extents=2).show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
height : int

extents : int | Sequence[int]

bracing : bool | None

size : float | None

strut : float | None

fn : int | None

fa : float | None

fs : float | None

property height : int

Central column height in cubes.

shape()[source]

Return the corner geometry.

Return type:

CsgSolid

show()[source]

Display the corner in the viewer.

Return type:

None

class pybosl2.parts.cubetruss.TrussSupport(extents=1, size=None, strut=None, fn=None, fa=None, fs=None)[source]

Bases: object

A diagonal support truss — a block cut on the diagonal and lightened.

extents is the vertical segment count, or an [X, Y, Z] count.

Examples

A 2-high support:

from pybosl2.parts.cubetruss import TrussSupport
TrussSupport(extents=2).show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
extents : int | Sequence[int]

size : float | None

strut : float | None

fn : int | None

fa : float | None

fs : float | None

shape()[source]

Return the support truss geometry.

Return type:

CsgSolid

show()[source]

Display the support truss in the viewer.

Return type:

None

class pybosl2.parts.cubetruss.TrussClip(extents=1, size=None, strut=None, clipthick=None, slop=0.0, fn=None, fa=None, fs=None)[source]

Bases: object

A pair of snap clips for the end of a truss.

Examples

A truss clip:

from pybosl2.parts.cubetruss import TrussClip
TrussClip().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
extents : int

size : float | None

strut : float | None

clipthick : float | None

slop : float

fn : int | None

fa : float | None

fs : float | None

shape()[source]

Return the clip geometry.

Return type:

CsgSolid

show()[source]

Display the clip in the viewer.

Return type:

None

class pybosl2.parts.cubetruss.TrussFoot(w=1, size=None, strut=None, clipthick=None, slop=0.0, fn=None, fa=None, fs=None)[source]

Bases: object

A foot that clips onto the bottom of a truss for support.

Examples

A truss foot:

from pybosl2.parts.cubetruss import TrussFoot
TrussFoot().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
w : int

size : float | None

strut : float | None

clipthick : float | None

slop : float

fn : int | None

fa : float | None

fs : float | None

shape()[source]

Return the foot geometry.

Return type:

CsgSolid

show()[source]

Display the foot in the viewer.

Return type:

None

class pybosl2.parts.cubetruss.TrussUClip(dual=True, size=None, strut=None, clipthick=None, slop=0.0, fn=None, fa=None, fs=None)[source]

Bases: object

A U-shaped clip that joins two trusses face to face.

Examples

A U-clip:

from pybosl2.parts.cubetruss import TrussUClip
TrussUClip().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
dual : bool

size : float | None

strut : float | None

clipthick : float | None

slop : float

fn : int | None

fa : float | None

fs : float | None

shape()[source]

Return the U-clip geometry.

Return type:

CsgSolid

show()[source]

Display the U-clip in the viewer.

Return type:

None

class pybosl2.parts.cubetruss.TrussJoiner(w=1, vert=True, size=None, strut=None, clipthick=None, slop=0.0, fn=None, fa=None, fs=None)[source]

Bases: object

A joiner that clips two trusses end to end.

Examples

A truss joiner:

from pybosl2.parts.cubetruss import TrussJoiner
TrussJoiner().show()
Loading 3-D preview…

⬇ Download STL mesh

Parameters:
w : int

vert : bool

size : float | None

strut : float | None

clipthick : float | None

slop : float

fn : int | None

fa : float | None

fs : float | None

shape()[source]

Return the joiner geometry.

Return type:

CsgSolid

show()[source]

Display the joiner in the viewer.

Return type:

None

pybosl2.parts.cubetruss.truss_dist(cubes=0, gaps=0, size=None, strut=None)[source]

Return the length of a truss cubes long, plus gaps extra strut-widths.

Parameters:
cubes : int

Number of cubes along the truss.

gaps : int

Number of extra strut-width gaps.

size : float | None

Cube size in mm. Defaults to CUBETRUSS_SIZE (30 mm).

strut : float | None

Strut thickness in mm. Defaults to CUBETRUSS_STRUT_SIZE (3 mm).

Returns:

The total length of the truss in mm.

Return type:

float

Examples

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

Truss

A 3-segment truss:

from pybosl2.parts.cubetruss import Truss
Truss(extents=3).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

A 2x3 grid of segments:

from pybosl2.parts.cubetruss import Truss
Truss(extents=[2,3]).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

TrussSegment

One segment, unbraced:

from pybosl2.parts.cubetruss import TrussSegment
TrussSegment(bracing=False).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

One segment, braced:

from pybosl2.parts.cubetruss import TrussSegment
TrussSegment(bracing=True).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

Thicker struts:

from pybosl2.parts.cubetruss import TrussSegment
TrussSegment(strut=4).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

A larger cube:

from pybosl2.parts.cubetruss import TrussSegment
TrussSegment(size=40).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

TrussCorner

A corner joint:

from pybosl2.parts.cubetruss import TrussCorner
TrussCorner(extents=2).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

A taller corner:

from pybosl2.parts.cubetruss import TrussCorner
TrussCorner(extents=2, height=2).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

TrussSupport

A diagonal support:

from pybosl2.parts.cubetruss import TrussSupport
TrussSupport().shape().show()
Loading 3-D preview…

⬇ Download STL mesh

Two segments long:

from pybosl2.parts.cubetruss import TrussSupport
TrussSupport(extents=2).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

Thicker struts:

from pybosl2.parts.cubetruss import TrussSupport
TrussSupport(strut=4).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

TrussFoot

A single-wide foot:

from pybosl2.parts.cubetruss import TrussFoot
TrussFoot(w=1).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

A triple-wide foot:

from pybosl2.parts.cubetruss import TrussFoot
TrussFoot(w=3).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

TrussJoiner

A horizontal joiner:

from pybosl2.parts.cubetruss import TrussJoiner
TrussJoiner(w=1, vert=False).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

A vertical joiner:

from pybosl2.parts.cubetruss import TrussJoiner
TrussJoiner(w=1, vert=True).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

TrussUClip

A single U-clip:

from pybosl2.parts.cubetruss import TrussUClip
TrussUClip(dual=False).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

A dual U-clip:

from pybosl2.parts.cubetruss import TrussUClip
TrussUClip(dual=True).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

TrussClip

A two-segment clip:

from pybosl2.parts.cubetruss import TrussClip
TrussClip(extents=2).shape().show()
Loading 3-D preview…

⬇ Download STL mesh

A one-segment clip:

from pybosl2.parts.cubetruss import TrussClip
TrussClip(extents=1).shape().show()
Loading 3-D preview…

⬇ Download STL mesh