Skip to content

Parts and stock

stock

Stock: the material parts are made from.

Stock dataclass

Stock(
    thickness: float, species: str = "", round: bool = False
)

Stock of a given thickness (mm): a board, or a rod (round) as thick as its diameter. The grain runs along its length.

rod classmethod

rod(diameter: float, species: str = '') -> Stock

Round stock: a dowel, a peg, a rung, a pole.

part

Parts made from stock, their local frame and their named sides.

A board is described as if it lies flat on the bench, length left to right, reference face up and reference arris (where the reference face meets the reference edge) towards the woodworker.

Part frame (mm): the origin lies on the reference arris at the left end, x runs along the length (grain), y across the width towards the back edge, z up along the normal of the reference face. The design box of a board is therefore [0, length] x [0, width] x [-thickness, 0].

A mirrored board is the mirror image of an unmirrored one with the same features, e.g. the right side of a case against the left one, both with their reference faces outside and reference edges at the front. Its part frame is the same, but its ends swap names: its left end lies at x = length. Joints and cuts on its named sides are then mirrored too.

A rod (round stock) is thought of as a square box with its four long arrises rounded off: its frame and design box are those of a board as wide and thick as its diameter, [0, length] x [0, diameter] x [-diameter, 0], its axis at y = diameter / 2, z = -diameter / 2. Its ends are real sides; its four long sides are virtual, the tangent planes of the box. They place the rod (flush with the top of a rail) and give directions for cross holes and flats, but cuts that need a planar side refuse them.

A board may be laminated: glued up from equal plies, then cut as one. The plies show as separate solids in the model (the glue lines in the drawings) and in the cut list.

Side

Side(axis: int, sign: int)

Bases: Enum

The six sides of a board, as (axis of the normal, its sign).

Part

Base class of parts: a named piece of stock with a design length.

The design box is the part as the user sees it between its joints, e.g. a rail from shoulder to shoulder. Joints may extend the blank beyond it. With mirror, its ends swap names (see the module docs).

box property

box: tuple[Point, Point]

Min and max corners of the design box in the part frame.

blank

blank(lo: Point, hi: Point) -> Part

The blank filling the box between lo and hi (the design box with any allowances), in the part frame.

is_virtual

is_virtual(side: Side) -> bool

Whether a side isn't a real planar side of the part (of a rod).

ply_boxes

ply_boxes(
    lo: Point, hi: Point
) -> list[tuple[Point, Point]]

The boxes of the plies the blank between lo and hi is glued up from.

side

side(side: Side) -> SideRef

The side named side; on a mirrored part the ends are swapped.

arris

arris(a: SideRef, b: SideRef) -> ArrisRef

The arris where two adjacent sides of this part meet.

cut

cut(cut: Cut) -> Cut

Add an explicit cut to this part.

Board dataclass

Board(
    name: str,
    stock: Stock,
    length: float,
    width: float,
    cuts: list[Cut] = list(),
    mirror: bool = False,
    plies: int = 1,
    plies_across: Literal[
        "thickness", "width"
    ] = "thickness",
)

Bases: Part

A named board with design dimensions; thickness comes from its stock.

With plies > 1, it is laminated from as many equal boards, stacked through its thickness (glued face to face, the glue lines showing on its edges and ends) or, with plies_across="width", side by side across its width (the glue lines on its faces and ends), e.g. a 90 mm square leg from two 45 x 90 mm boards.

Rod dataclass

Rod(
    name: str,
    stock: Stock,
    length: float,
    cuts: list[Cut] = list(),
    mirror: bool = False,
)

Bases: Part

A named rod of round stock: a dowel, a peg, a rung, a pole.

Its frame is that of its bounding box (see the module docs); its long sides (top_face, front_edge, ...) are virtual. Allowances only go on its ends.

axis property

axis: tuple[float, float]

The y and z coordinates of the rod's axis in its frame.

SideRef dataclass

SideRef(part: Part, side: Side)

A reference to one side of a part's design box.

virtual property

virtual: bool

Whether the side isn't a real planar side of the part (a long side of a rod).

normal property

normal: Vector

Outward unit normal in the part frame.

plane property

plane: Plane

Plane of the side in the part frame.

z is the outward normal. x runs along the length for faces and edges, along the width for ends. y follows from the right-hand rule. The origin is the corner of the side such that the side covers [0, size[0]] x [0, size[1]] in plane coordinates. The plane is the same on a mirrored board: x runs from its right end.

size property

size: tuple[float, float]

Extent of the side along the plane's x and y.

depth property

depth: float

Depth of material behind the side (the part's extent along the normal).

coordinate property

coordinate: float

Coordinate of the side along its axis in the part frame.

name property

name: str

The name of the side, e.g. left_end (swapped on a mirrored board).

ArrisRef dataclass

ArrisRef(a: SideRef, b: SideRef)

The geometric edge where two adjacent sides of a part meet.

endpoints property

endpoints: tuple[Vector, Vector]

The two ends of the arris in the part frame, in increasing coordinate.