pyvista_cad.CadDataSetAccessor.tessellate

pyvista_cad.CadDataSetAccessor.tessellate#

CadDataSetAccessor.tessellate(*, linear_deflection=None, angular_deflection=0.5)[source]#

Re-tessellate this mesh from its cached originating B-rep.

Reuses the exact TopoDS_Shape stashed when this mesh was produced by a CAD reader (STEP, BREP, IGES, build123d bridge) and re-meshes it at the requested deflections. This does not decimate or remesh the existing triangulation; it goes back to the analytic geometry. The chosen deflections are stamped into field data and surface as tessellation_quality.

A mesh with no cached B-rep origin cannot be re-tessellated and raises rather than silently returning the existing facets.

Parameters:
linear_deflectionfloat, optional

Maximum chordal deviation between a facet and the true surface, in dataset units. When None, defaults to 0.001 of the bounding-box diagonal.

angular_deflectionfloat, default: 0.5

Maximum angle (radians) between adjacent facet normals.

Returns:
pyvista.PolyData

The freshly tessellated surface, carrying cad.linear_deflection / cad.angular_deflection.

Raises:
pyvista_cad.CadError

If no cached originating TopoDS_Shape is associated with the mesh (it was not produced by a CAD reader).

Parameters:
  • linear_deflection (float | None)

  • angular_deflection (float)

Return type:

PolyData

Examples

>>> import pyvista_cad
>>> from pyvista_cad import examples
>>> mesh = pyvista_cad.read_step(examples.step_cube)
>>> retess = mesh.cad.tessellate(linear_deflection=0.02)
>>> retess.n_cells > 0
True
>>> retess.cad.tessellation_quality['linear_deflection']
0.02