pyvista.Text3D#
- Text3D(
- string: str,
- depth: float | None = None,
- width: float | None = None,
- height: float | None = None,
- center: VectorLike[float] = (0.0, 0.0, 0.0),
- normal: VectorLike[float] = (0.0, 0.0, 1.0),
Create 3D text from a string.
The text may be configured to have a specified width, height or depth.
- Parameters:
- string
str
String to generate 3D text from. If
None
or an empty string, the output mesh will have a single point atcenter
.- depth
float
,optional
Depth of the text. If
None
, the depth is set to half theheight
by default. Set to0.0
for planar text.Changed in version 0.43: The default depth is now calculated dynamically as half the height. Previously, the default depth had a fixed value of
0.5
.- width
float
,optional
Width of the text. If
None
, the width is scaled proportional toheight
.Added in version 0.43.
- height
float
,optional
Height of the text. If
None
, the height is scaled proportional towidth
.Added in version 0.43.
- center
Sequence
[float
], default: (0.0, 0.0, 0.0) Center of the text, defined as the middle of the axis-aligned bounding box of the text.
Added in version 0.43.
- normal
Sequence
[float
], default: (0.0, 0.0, 1.0) Normal direction of the text. The direction is parallel to the
depth
of the text and points away from the front surface of the text.Added in version 0.43.
- string
- Returns:
pyvista.PolyData
3D text mesh.
Examples
>>> import pyvista as pv >>> text_mesh = pv.Text3D('PyVista') >>> text_mesh.plot(cpos='xy')