pyvista_cad.CadDataSetAccessor#
- class CadDataSetAccessor(dataset)[source]#
The
.cadaccessor on every PyVistapyvista.DataSet.Surfaces
cad.*field-data and cell-data as Python attributes, routes to the CAD readers / writers, and exposes per-mesh helpers such astessellate(),exact_volume(), andcenter_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
Methods
__init__(dataset)cad_view(**kwargs)Resolve to a
{'faces', 'edges'}CAD-view MultiBlock.Return the exact centre of mass from the cached
TopoDS_Shape.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.layercell value.tessellate(*[, linear_deflection, ...])Re-tessellate this mesh from its cached originating B-rep.
to_3mf(path, /, *[, units])Write to
pathas a 3MF file.to_brep(path, /)Write to
pathas a faceted BREP file.Wrap the dataset as a faceted
build123d.Compound.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
pathas a glTF (.gltf/.glb) file.to_gmsh(*[, model_name])Install the dataset as the current gmsh model.
to_step(path, /)Write to
pathas a faceted STEP file.Build a faceted
TopoDSshape from the dataset.Attributes
Dataset-level RGB color, or
None.Whether this dataset has a recoverable B-rep origin.
Dataset-level label, or
None.Sorted unique DXF / cell-data layer names.
Live
CadMetadataview.Originating CAD format ('STEP', 'DXF', ...) or
None.Tessellation deflections last used to build this mesh.
Canonical unit string or
None.