pyboxbuilder.lid.builder.LidBuilder¶
- class pyboxbuilder.lid.builder.LidBuilder(text: str | None = None, label_mode: LabelMode | None = None, label_shape: LabelShape | str | None = None, font: str | None = None, text_spacing: float | None = None, label_finial: LabelFinial | str | None = None, diagonal: bool | None = None, text_color: Color | None = None, frame_color: Color | None = None, pattern: PatternBuilder | PatternType | str | None = PatternBuilder(type=<PatternType.HEX: 'hex'>, colors=(), spacing=None, web=None, border=None, inlay=False, through_inlay=False, inlay_depth_mm=None, through_holes=False, hole_ratio=0.5, backing_pattern=<PatternType.HEX: 'hex'>, backing_spacing=None, backing_web=None, top_skin_mm=None), pattern_color: Color | str | None = None, pattern_colors: tuple[Color | str, ...] | list[Color | str] | None = None, pattern_through_inlay: bool | tuple[int, ...] | None = None, pattern_inlay_depth_mm: float | None = None, backing_pattern: PatternBuilder | PatternType | str | None = None, top_skin_mm: float | None = None, logo: Any | None = None, logo_color: Color | None = None, logo_position: str | None = None, label_logo_size_mm: float | None = None, min_text_height_mm: float | None = None, max_text_height_mm: float | None = None, border_margin_mm: float | None = None, label_border_mm: float | None = None, label_text_gap_mm: float | None = None, label_rounding_mm: float | None = None, label_solid_background: bool | None = None, label_background_color: Color | str | None = None, label_clearance_mm: float | None = None, label_center: tuple[float, float] | None = None, label_area: tuple[float, float, float, float] | None = None, min_hole_size_mm: float = 10.0, mmu_label: LidBuilder | None = None, single_label: LidBuilder | None = None)[source]¶
Bases:
objectLid decoration configuration.
One of these usually describes a style rather than a single lid — the same frame, pattern and colours across a whole insert — so
titled()makes a copy carrying one box’s text instead of repeating the style at every box (FR-000b):LEAF = LidBuilder(label_mode=LabelMode.FRAMELESS, diagonal=True, pattern=PatternBuilder(PatternType.HEX)) ... project.box(BoxType.SLIDING, "Favor", lid=LEAF.titled("Favors"))Examples
A frameless diagonal label on a hex-patterned lid:
project = Project("FancyGame", game_box_size=(300, 200, 80)) STYLE = LidBuilder( label_mode=LabelMode.FRAMELESS, diagonal=True, pattern=PatternBuilder(PatternType.HEX, spacing=10.0), ) project.box( BoxType.SLIDING, "Treasure", size=(90, 70, 40), lid=STYLE.titled("Treasure", text_color=Color("gold")), ) project.show(only="Treasure")Loading 3-D preview…- for_mode(mode: ColorMode | str) LidBuilder[source]¶
Return this lid as it prints in one colour mode.
A per-mode override carries only the fields it sets. That has to be decided by what the caller passed rather than by comparing against the field’s default, which is what this used to do: a single_label asking for LabelMode.FRAMED was indistinguishable from one that said nothing, diagonal=False could not turn off a diagonal, and the margins were taken from the override whether it mentioned them or not.
- resolve_for_mode(mode: ColorMode | str) LidBuilder[source]¶
Return the deprecated alias for
for_mode().
- titled(text: str, **overrides: Any) LidBuilder[source]¶
Return this lid style, carrying a particular box’s text.
-
backing_pattern : PatternBuilder | PatternType | str | None =
None¶ Override for the backing lattice pattern on the lid underside behind top-layer inlays (defaults to HEX).
-
border_margin_mm : float | None =
None¶ Margin the auto-sized label keeps clear of the lid’s edge;
NoneusesBORDER_MARGIN_MM.
- property finial : LabelFinial¶
The decorative ornament placed underneath label text, resolved.
-
font : str | None =
None¶ Font family/style for lid label text (e.g.
"Futura:style=Bold");Noneuses the library default ("Liberation Sans:style=Bold").
-
frame_color : Color | None =
None¶ Top-layer colour of the framed label’s outer edge border ring;
Noneleaves the border the box’s own lid colour. The interior 1.5mm spacing and strips holding the text always keep the lid colour with open through-holes between the strips.
-
label_area : tuple[float, float, float, float] | None =
None¶ Explicit
(x, y, width, length)bounding box for the label in the lid’s local frame.When
Noneon a polygon lid, the largest inscribed rectangle is used.
-
label_background_color : Color | str | None =
None¶ Top-layer colour for the solid interior background inside a framed label’s border ring. Setting a colour automatically enables a solid background (no hatching holes);
Noneleaves a solid background in the lid’s own colour.
-
label_border_mm : float | None =
None¶ Solid outer border width of the label backing plate;
Noneuses defaults.
-
label_center : tuple[float, float] | None =
None¶ Explicit
(x, y)center position for the label in the lid’s local frame.When
Noneon a polygon lid, the label is placed in the largest inscribed rectangular space.
-
label_clearance_mm : float | None =
None¶ Solid margin kept around the lettering where a pattern meets it.
NoneusesLABEL_CLEARANCE_MM, which is0: the holes stop at the glyphs, so the letters read as letters and not as letters on a plaque. They keep their support either way — the keep-out is the glyph outline, and the label is inlaid into the lid rather than perched on it. Raise it for a lid whose pattern is coarse enough that a stroke would otherwise finish on the very edge of a hole.
-
label_finial : LabelFinial | str | None =
None¶ Decorative typographic ornament placed underneath the label text (
NONE,DIAMOND,TRIPLE_DOT,FLEURON,CHEVRON,SCROLLWORK, orSPEAR). Inlaid inframe_colorwhen set, falling back totext_color.
-
label_logo_size_mm : float | None =
None¶ Target height/width in mm for an image/logo bay embedded inside a framed label.
Nonesizes it automatically from the text height and available lid area.
-
label_mode : LabelMode | None =
None¶ Framed (border + hatching behind the text) or frameless (text only).
NonemeansFRAMED. It is spelled asNonerather than defaulted directly so a per-mode override can tell “I want framed” from “I said nothing about the frame” — seefor_mode().
-
label_rounding_mm : float | None =
None¶ Corner rounding radius of the label backing plate;
Noneuses defaults.
-
label_shape : LabelShape | str | None =
None¶ Plaque silhouette for framed labels (
RECT,PILL,CHAMFERED,HEXAGON,HEX_BRACKET,NOTCHED,RIBBON,DOUBLE_FRAME,UNDERLINE,OVAL,SCALLOPED,BRACKET,SHIELD,SCROLL,CORNER_STUD, orORNATE_FRAME).Nonedefaults toRECT. Non-rect decorative shapes default to a clean solid interior plaque unlesslabel_solid_background=Falseis passed explicitly.
-
label_solid_background : bool | None =
None¶ Use a solid unperforated background inside a framed label instead of diagonal hatching slots;
Noneuses open through-hole strips unlesslabel_background_coloris set.
-
label_text_gap_mm : float | None =
None¶ Gap between label text and inside of the border;
Noneuses defaults.
-
logo : Any | None =
None¶ SVG path (monochrome or multi-colour), a single- or multi-coloured
Bosl2Solid, aPatternResult, a sequence of(shape, colour)pairs, or a callable(width, length, depth) -> ...returning any of those.
-
logo_color : Color | None =
None¶ Default colour for uncoloured logo parts in inlaid mode;
Noneusestext_color.
-
logo_position : str | None =
None¶ Placement of
logowhen combined withtextinside a label:"top"(default when bothtextandlogoare set),"left","right","bottom", or"center"(overlapping / standalone).
-
max_text_height_mm : float | None =
None¶ Maximum cap height for auto-sized label text in mm;
NoneusesMAX_TEXT_HEIGHT_MM.
-
min_hole_size_mm : float =
10.0¶ Minimum span (width/length in mm) for the central opening in a polygon lid frame.
If the inner opening in the middle is smaller than this value, it is omitted, leaving the label plate continuous and solid.
-
min_text_height_mm : float | None =
None¶ Below this the label is skipped rather than printed illegibly (FR-020).
NoneusesMIN_TEXT_HEIGHT_MM.
-
mmu_label : LidBuilder | None =
None¶ Fields to override for the multi-material export (see
for_mode()).
-
pattern : PatternBuilder | PatternType | str | None =
PatternBuilder(type=<PatternType.HEX: 'hex'>, colors=(), spacing=None, web=None, border=None, inlay=False, through_inlay=False, inlay_depth_mm=None, through_holes=False, hole_ratio=0.5, backing_pattern=<PatternType.HEX: 'hex'>, backing_spacing=None, backing_web=None, top_skin_mm=None)¶ Through-hole pattern, or
Nonefor a plain lid.
-
pattern_color : Color | str | None =
None¶ Colour of the pattern’s top layer;
Nonecontrasts with the body.
-
pattern_colors : tuple[Color | str, ...] | list[Color | str] | None =
None¶ Palette of colours for multi-colour patterns; falls back to pattern.colors or pattern_color.
-
pattern_through_inlay : bool | tuple[int, ...] | None =
None¶ Override for whether pattern inlays extend completely through the lid thickness.
- property shape : LabelShape¶
The framed label plaque shape, resolved.
-
single_label : LidBuilder | None =
None¶ Fields to override for the single-colour export.
-
text_color : Color | None =
None¶ Colour the lettering is inlaid in;
Noneuses black (FR-022).A label is read against a lid whose colour is the game’s choice, so the default is the one colour that reads against all of them.