Extrusions¶
⚙️ Spec sheet → — visual schematic and metrics measured from a real rendered STL.
Text3d, path_text, cross and extrusion-related math helpers.
-
pybosl2.shapes3d.extrusions.text3d(text, height=
1, size=10, font='Liberation Sans', halign=None, valign=None, spacing=1.0, direction='ltr', language='em', script='latin', anchor='baseline[-1,0,-1]', spin=0, orient=Anchor.TOP, fn=None, fa=None, fs=None)[source]¶ BOSL2 text3d() – 3-D extruded text, with anchor/spin/orient support.
- Parameters:¶
- text : str¶
text to create
- height : float¶
extrusion height (default 1)
- size : float¶
font size divided by 0.72 (default 10)
- font : str¶
font to use (default “Liberation Sans”)
- halign : str | None¶
horizontal alignment: “left”, “center”, “right” (overrides anchor)
- valign : str | None¶
vertical alignment: “top”, “center”, “baseline”, “bottom” (overrides anchor)
- spacing : float¶
relative spacing multiplier between characters (default 1.0)
- direction : str¶
text direction: “ltr”, “rtl”, “ttb”, “btt” (default “ltr”)
- language : str¶
language the text is in (default “en”)
- script : str¶
script the text is in (default “latin”)
- anchor : str¶
anchor point (default “baseline”)
- spin : float¶
Z-axis rotation in degrees (default 0)
- orient : Anchor | Sequence[float]¶
direction to rotate the top towards (default UP)
- fn : int | None¶
number of fragments for circle resolution.
- fa : float | None¶
minimum fragment angle for circle resolution.
- fs : float | None¶
minimum fragment size for circle resolution.
- Return type:¶
Bosl2Solid
Examples
from pybosl2 import text3d text3d("BOSL2", size=10, height=3).show()Loading 3-D preview…
-
pybosl2.shapes3d.extrusions.path_text(path, text, font=
'Liberation Sans', size=10, thickness=None, lettersize=None, offset=0, reverse=False, normal=None, top=None, center=False, textmetrics=False, kern=0, fn=None, fa=None, fs=None)[source]¶ BOSL2 path_text() – places text characters along a path.
- Parameters:¶
- path : Path2D | Path3D¶
path to place the text on
- text : str¶
text to create
- font : str¶
font to use (default “Liberation Sans”)
- size : float¶
font size divided by 0.72 (default 10)
- thickness : float | None¶
thickness of the letters (not allowed for a 2-D path)
- lettersize : float | Sequence[float] | None¶
scalar or array giving the size of the letters
- center : bool¶
center text on the path instead of starting at the first point (default False)
- offset : float¶
distance to shift letters “up” towards the reader (default 0, 3-D paths only)
- normal : Sequence[float] | list[list[float]] | None¶
direction(s) pointing towards the reader of the text (3-D paths only)
- top : Sequence[float] | list[list[float]] | None¶
direction(s) pointing towards the top of the text
- reverse : bool¶
reverse the letters if true (default False, 3-D paths only)
- textmetrics : bool¶
use the experimental textmetrics feature when lettersize is not given (default False)
- kern : float | Sequence[float]¶
scalar or array giving per-letter size adjustments (default 0)
- fn : int | None¶
number of fragments for circle resolution.
- fa : float | None¶
minimum fragment angle for circle resolution.
- fs : float | None¶
minimum fragment size for circle resolution.
- Return type:¶
Bosl2Solid
-
pybosl2.shapes3d.extrusions.cross(size=
[10, 10], height=None, arm_width=None, length=None, center=None, anchor=Anchor.CENTER, spin=0, orient=Anchor.TOP)[source]¶ Return a 3-D cross (plus) shape: two perpendicular centred rectangular prisms.
Builds from the 2‑D
cross()polygon linear-extruded to height.- Parameters:¶
- size : float | Sequence[float]¶
overall XY size, a scalar square or
[width, length](default[10, 10]).- height : float | None¶
Z-axis thickness (mutually exclusive with length).
- arm_width : float | Sequence[float] | None¶
width of each arm; a scalar or
[horizontal, vertical]pair. When None (default) the arms are one-third of the overall size.- length : float | None¶
alias for height.
- center : bool | None¶
centre alignment (default True).
- anchor : Anchor | Sequence[float]¶
anchor point (default Anchor.CENTER).
- spin : float¶
Z-axis rotation in degrees after anchor (default 0).
- orient : Anchor | Sequence[float]¶
direction to rotate the top towards, after spin (default Anchor.TOP).
- Returns:¶
A
Bosl2Solid.- Return type:¶
Bosl2Solid
Examples
from pybosl2 import cross cross(size=30, height=5).show()Loading 3-D preview…