pyvista.PolyDataFilters.extrude_rotate#

PolyDataFilters.extrude_rotate(resolution=30, inplace=False, translation=0.0, dradius=0.0, angle=360.0, capping=None, rotation_axis=(0, 0, 1), progress_bar=False)[source]#

Sweep polygonal data creating “skirt” from free edges and lines, and lines from vertices.

This takes polygonal data as input and generates polygonal data on output. The input dataset is swept around the axis to create new polygonal primitives. These primitives form a “skirt” or swept surface. For example, sweeping a line results in a cylindrical shell, and sweeping a circle creates a torus.

There are a number of control parameters for this filter. You can control whether the sweep of a 2D object (i.e., polygon or triangle strip) is capped with the generating geometry via the capping parameter. Also, you can control the angle of rotation, and whether translation along the axis is performed along with the rotation. (Translation is useful for creating “springs”.) You also can adjust the radius of the generating geometry with the dradius parameter.

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.

This filter can be used to model axisymmetric objects like cylinders, bottles, and wine glasses; or translational rotational symmetric objects like springs or corkscrews.

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:
resolutionint, optional

Number of pieces to divide line into.

inplacebool, default: False

Overwrites the original mesh inplace.

translationfloat, optional

Total amount of translation along the axis.

dradiusfloat, optional

Change in radius during sweep process.

anglefloat, optional

The angle of rotation in degrees.

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.

rotation_axisnumpy.ndarray or sequence, optional

The direction vector of the axis around which the rotation is done. It requires vtk>=9.1.0.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.PolyData

Rotationally extruded mesh.

Examples

Create a “spring” using the rotational extrusion filter.

>>> import pyvista as pv
>>> profile = pv.Polygon(
...     center=[1.25, 0.0, 0.0],
...     radius=0.2,
...     normal=(0, 1, 0),
...     n_sides=30,
... )
>>> extruded = profile.extrude_rotate(
...     resolution=360,
...     translation=4.0,
...     dradius=0.5,
...     angle=1500.0,
...     capping=True,
... )
>>> extruded.plot(smooth_shading=True)
../../../_images/pyvista-PolyDataFilters-extrude_rotate-1_00_00.png

Create a “wine glass” using the rotational extrusion filter.

>>> import numpy as np
>>> points = np.array(
...     [
...         [-0.18, 0, 0],
...         [-0.18, 0, 0.01],
...         [-0.18, 0, 0.02],
...         [-0.01, 0, 0.03],
...         [-0.01, 0, 0.04],
...         [-0.02, 0, 0.5],
...         [-0.05, 0, 0.75],
...         [-0.1, 0, 0.8],
...         [-0.2, 0, 1.0],
...     ]
... )
>>> spline = pv.Spline(points, 30)
>>> extruded = spline.extrude_rotate(resolution=20, capping=False)
>>> extruded.plot(color='lightblue')
../../../_images/pyvista-PolyDataFilters-extrude_rotate-1_01_00.png