pyvista.Text3D#

Text3D(string, depth=None, width=None, height=None, center=(0, 0, 0), normal=(0, 0, 1))[source]#

Create 3D text from a string.

The text may be configured to have a specified width, height or depth.

Parameters:
stringstr

String to generate 3D text from. If None or an empty string, the output mesh will have a single point at center.

depthfloat, optional

Depth of the text. If None, the depth is set to half the height by default. Set to 0.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.

widthfloat, optional

Width of the text. If None, the width is scaled proportional to height.

Added in version 0.43.

heightfloat, optional

Height of the text. If None, the height is scaled proportional to width.

Added in version 0.43.

centerSequence[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.

normalSequence[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.

Returns:
pyvista.PolyData

3D text mesh.

Examples

>>> import pyvista as pv
>>> text_mesh = pv.Text3D('PyVista')
>>> text_mesh.plot(cpos='xy')
../../../_images/pyvista-Text3D-1_00_00.png