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 thedradius
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 ofFalse
. The previously used VTK default corresponds tocapping=True
. In a future version the default will be changed toTrue
to match the behavior of the underlying VTK filter.- Parameters:
- resolution
int
,optional
Number of pieces to divide line into.
- inplacebool,
optional
Overwrites the original mesh inplace.
- translation
float
,optional
Total amount of translation along the axis.
- dradius
float
,optional
Change in radius during sweep process.
- angle
float
,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 ofFalse
. In a future version this default will be changed toTrue
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_axis
numpy.ndarray
or sequence,optional
The direction vector of the axis around which the rotation is done. It requires vtk>=9.1.0.
- progress_barbool,
optional
Display a progress bar to indicate progress.
- resolution
- Returns:
pyvista.PolyData
Rotationally extruded mesh.
Examples
Create a “spring” using the rotational extrusion filter.
>>> import pyvista >>> profile = pyvista.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)
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 = pyvista.Spline(points, 30) >>> extruded = spline.extrude_rotate(resolution=20, capping=False) >>> extruded.plot(color='tan')