pyvista.CylinderStructured#
- CylinderStructured(
- radius=0.5,
- height=1.0,
- center=(0.0, 0.0, 0.0),
- direction=(1.0, 0.0, 0.0),
- theta_resolution=32,
- z_resolution=10,
Create a cylinder mesh as a
pyvista.StructuredGrid
.The end caps are left open. This can create a surface mesh if a single value for the
radius
is given or a 3D mesh if multiple radii are given as a list/array in theradius
argument.- Parameters:
- radius
float
| sequence[float
], default: 0.5 Radius of the cylinder. If a sequence, then describes the radial coordinates of the cells as a range of values as specified by the
radius
.- height
float
, default: 1.0 Height of the cylinder along its Z-axis.
- centersequence[
float
], default: (0.0, 0.0, 0.0) Location of the centroid in
[x, y, z]
.- directionsequence[
float
], default: (1.0, 0.0, 0.0) Direction cylinder Z-axis in
[x, y, z]
.- theta_resolution
int
, default: 32 Number of points on the circular face of the cylinder. Ignored if
radius
is an iterable.- z_resolution
int
, default: 10 Number of points along the height (Z-axis) of the cylinder.
- radius
- Returns:
pyvista.StructuredGrid
Structured cylinder.
Notes
Changed in version 0.38.0: Prior to version 0.38, this method had incorrect results, producing inconsistent number of points on the circular face of the cylinder.
Examples
Default structured cylinder
>>> import pyvista as pv >>> mesh = pv.CylinderStructured() >>> mesh.plot(show_edges=True)
Structured cylinder with an inner radius of 1, outer of 2, with 5 segments.
>>> import numpy as np >>> mesh = pv.CylinderStructured(radius=np.linspace(1, 2, 5)) >>> mesh.plot(show_edges=True)