pyvista.PolyDataFilters.extrude

pyvista.PolyDataFilters.extrude#

PolyDataFilters.extrude(vector, capping=None, inplace=False, progress_bar=False)[source]#

Sweep polygonal data creating a “skirt” from free edges.

This will create a line from vertices.

This takes polygonal data as input and generates polygonal data on output. The input dataset is swept according to some extrusion function and creates new polygonal primitives. These primitives form a “skirt” or swept surface. For example, sweeping a line results in a quadrilateral, and sweeping a triangle creates a “wedge”.

The skirt is generated by locating certain topological features. Free edges (edges of polygons or triangle strips only used by one polygon or triangle strips) generate surfaces. This is true also of lines or polylines. Vertices generate lines.

Changed in version 0.32.0: The capping keyword was added with a default of False. The previously used VTK default corresponds to capping=True. In a future version the default will be changed to True to match the behavior of the underlying VTK filter.

Parameters:
vectornumpy.ndarray or sequence

Direction and length to extrude the mesh in.

cappingbool, optional

Control if the sweep of a 2D object is capped. The default is False, which differs from VTK’s default.

Warning

The capping keyword was added in version 0.32.0 with a default value of False. In a future version this default will be changed to True to match the behavior of the underlying VTK filter. It is recommended to explicitly pass a value for this keyword argument to prevent future changes in behavior and warnings.

inplacebool, default: False

Overwrites the original mesh in-place.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.PolyData

Extruded mesh.

Examples

Extrude a half circle arc.

>>> import pyvista as pv
>>> arc = pv.CircularArc([-1, 0, 0], [1, 0, 0], [0, 0, 0])
>>> mesh = arc.extrude([0, 0, 1], capping=False)
>>> mesh.plot(color='lightblue')
../../../_images/pyvista-PolyDataFilters-extrude-1_00_00.png

Extrude and cap an 8 sided polygon.

>>> poly = pv.Polygon(n_sides=8)
>>> mesh = poly.extrude((0, 0, 1.5), capping=True)
>>> mesh.plot(line_width=5, show_edges=True)
../../../_images/pyvista-PolyDataFilters-extrude-1_01_00.png