pyvista_cad.CadDataSetAccessor

pyvista_cad.CadDataSetAccessor#

class CadDataSetAccessor(dataset)[source]#

The .cad accessor on every PyVista pyvista.DataSet.

Surfaces cad.* field-data and cell-data as Python attributes, routes to the CAD readers / writers, and exposes per-mesh helpers such as tessellate(), exact_volume(), and center_of_mass().

Parameters:
datasetpyvista.DataSet

The dataset this accessor is bound to.

Parameters:

dataset (DataSet)

Examples

>>> import pyvista as pv
>>> import pyvista_cad
>>> pv.Sphere().cad.source_format is None
True
__init__(dataset)[source]#
Parameters:

dataset (DataSet)

Return type:

None

Methods

__init__(dataset)

cad_view(**kwargs)

Resolve to a {'faces', 'edges'} CAD-view MultiBlock.

center_of_mass()

Return the exact centre of mass from the cached TopoDS_Shape.

exact_volume()

Return the exact volume from the cached TopoDS_Shape.

plot(**kwargs)

CAD-friendly plot: shaded faces + topological edges.

set_metadata(*[, units, label, color, ...])

Write the standard cad.* metadata into this dataset.

set_units(target, *[, convert])

Update cad.units, optionally rescaling point coordinates.

split_by_color([color_array])

Split into one block per per-cell RGB color.

split_by_label([label_array])

Split a composite mesh by the values of a per-cell label array.

split_by_layer([layer_array])

Split into one block per cad.layer cell value.

tessellate(*[, linear_deflection, ...])

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

to_3mf(path, /, *[, units])

Write to path as a 3MF file.

to_brep(path, /)

Write to path as a faceted BREP file.

to_build123d()

Wrap the dataset as a faceted build123d.Compound.

to_cadquery()

Wrap the dataset as a faceted cadquery.Workplane.

to_dxf(path, /, *[, layer, layer_array, ...])

Write this dataset as a DXF file.

to_gltf(path, /)

Write to path as a glTF (.gltf / .glb) file.

to_gmsh(*[, model_name])

Install the dataset as the current gmsh model.

to_step(path, /)

Write to path as a faceted STEP file.

to_topods()

Build a faceted TopoDS shape from the dataset.

Attributes

color

Dataset-level RGB color, or None.

has_brep_origin

Whether this dataset has a recoverable B-rep origin.

label

Dataset-level label, or None.

layers

Sorted unique DXF / cell-data layer names.

metadata

Live CadMetadata view.

source_format

Originating CAD format ('STEP', 'DXF', ...) or None.

tessellation_quality

Tessellation deflections last used to build this mesh.

units

Canonical unit string or None.