pyboxbuilder.lid.builder.PatternBuilder¶
-
class pyboxbuilder.lid.builder.PatternBuilder(type: PatternType | str =
PatternType.HEX, colors: tuple[Color | str, ...] | list[Color | str] =(), spacing: float | None =None, web: float | None =None, border: float | None =None, inlay: bool | None =None, through_inlay: bool | tuple[int, ...] =False, inlay_depth_mm: float | None =None, through_holes: bool =False, hole_ratio: float =0.5, backing_pattern: PatternType | str | None =PatternType.HEX, backing_spacing: float | None =None, backing_web: float | None =None, top_skin_mm: float | None =None)[source]¶ Bases:
objectThrough-hole pattern configuration for a lid.
A pattern is specified by the pitch between holes and the web left between them. The web is the one with a right answer — it is what prints, and what carries the lid — so it is the one to state; the hole size follows from the two.
-
classmethod penrose(colors: tuple[Color | str, ...] | list[Color | str] =
(), *, thick_colors: tuple[Color | str, ...] | list[Color | str] | Color | str | None =None, thin_colors: tuple[Color | str, ...] | list[Color | str] | Color | str | None =None, spacing: float | None =None, web: float | None =None, border: float | None =None, backing_pattern: PatternType | str | None =PatternType.HEX, **kwargs: Any) PatternBuilder[source]¶ Create a multi-colour 10-fold quasiperiodic Penrose rhombus tessellation pattern.
Supports 2, 3, 4, 5 or more colours via
colors=(...), or separatethick_colors(72° rhombi) andthin_colors(36° rhombi).
-
classmethod stepped_cube(colors: tuple[Color | str, ...] | list[Color | str] =
(), *, peak_color: Color | str | None =None, valley_color: Color | str | None =None, left_color: Color | str | None =None, right_color: Color | str | None =None, spacing: float | None =None, web: float | None =None, border: float | None =None, backing_pattern: PatternType | str | None =PatternType.HEX, **kwargs: Any) PatternBuilder[source]¶ Create a 4-colour stepped 3D cube & diamond tessellation pattern.
Colours can be passed as a sequence
colors=(peak, valley, left, right)or individually viapeak_color,valley_color,left_color, andright_color(any omitted face falls back to the default stepped-cube palette).
-
backing_pattern : PatternType | str | None =
'hex'¶ Lattice pattern cut into the back of the lid behind top-layer inlays to reduce plastic use (defaults to HEX).
-
backing_spacing : float | None =
None¶ Centre-to-centre distance between holes in the backing lattice, in mm;
Nonederives from lid size.
-
backing_web : float | None =
None¶ Material left between neighbouring holes in the backing lattice, in mm;
Noneuses default web.
-
border : float | None =
None¶ Solid margin around the whole pattern, in mm.
NoneusesPATTERN_BORDER_MM.0runs the pattern to the lid’s edge, which is rarely what a lid wants — see that constant.
-
colors : tuple[Color | str, ...] | list[Color | str] =
()¶ Accent colours for the pattern’s top layer, if any.
-
hole_ratio : float =
0.5¶ Relative inner hole size for shapes with holes (such as RING), from 0.1 to 0.9.
-
inlay : bool | None =
None¶ When True, inlay the pattern flush into the lid;
Nonedefaults toTruefor multi-colour patterns.
-
inlay_depth_mm : float | None =
None¶ Depth in mm of top-layer inlays (defaults to INLAY_DEPTH_MM = 0.6mm).
-
spacing : float | None =
None¶ Centre-to-centre distance between holes, in mm.
Nonederives it from the area being filled — an eighth of its shorter side, never below 5mm — so the same pattern reads the same on a token lid and a card lid.
-
through_holes : bool =
False¶ When True in inlay mode, cutouts/holes inside pattern shapes penetrate completely through the lid.
-
through_inlay : bool | tuple[int, ...] =
False¶ When True, colored inlays extend completely through the lid thickness instead of just the top layer. Can also be a tuple of color indices (e.g. (0,)) that extend through the lid while others remain top-layer.
-
top_skin_mm : float | None =
None¶ Solid top skin thickness in mm supporting thin colored inlays above the backing lattice (defaults to 0.8mm).
-
type : PatternType | str =
'hex'¶ Which pattern to cut. See
PatternType.
-
classmethod penrose(colors: tuple[Color | str, ...] | list[Color | str] =