pyboxbuilder.lid.pattern.build_pattern¶
-
pyboxbuilder.lid.pattern.build_pattern(width: float, length: float, thickness: float, pattern_type: PatternType | str, spacing: float | None =
None, web: float | None =None, colors: collections.abc.Sequence[Color] | None =None, through_holes: bool =False, hole_ratio: float =0.5, inlay: bool =False, lid_thickness: float | None =None, through_inlay: bool | collections.abc.Sequence[int] =False) Bosl2Solid | PatternResult | None[source]¶ Build the through-hole or inlaid pattern for a lid.
- Parameters:¶
- width: float¶
Width of the area to fill, in mm — the lid less its border.
- length: float¶
Length of that area, in mm.
- thickness: float¶
Pattern thickness (inlay depth or lid thickness).
- pattern_type: PatternType | str¶
Which pattern.
PatternType.NONEandPatternType.SOLIDreturnNone.- spacing: float | None =
None¶ Centre-to-centre distance between holes.
Nonederives it from the area (seedefault_spacing()).- web: float | None =
None¶ Material left between neighbouring holes.
NoneusesDEFAULT_WEB_MM.- colors: collections.abc.Sequence[Color] | None =
None¶ Palette of colors for multi-color patterns.
- through_holes: bool =
False¶ When True with inlay, internal holes inside pattern shapes cut completely through the lid.
- hole_ratio: float =
0.5¶ Ratio of inner hole to outer shape for annular shapes.
- inlay: bool =
False¶ Whether the pattern is flush-inlaid rather than through-holes.
- lid_thickness: float | None =
None¶ Full thickness of the lid (for through-hole cuts).
- through_inlay: bool | collections.abc.Sequence[int] =
False¶ When True, colored inlays extend completely through the lid thickness. Can also be a sequence of color indices that extend through the lid.
- Returns:¶
A solid or
PatternResult, orNonewhen none fit.- Raises:¶
ValueError – If the pattern has no fill registered.