pyvista_cad.CadMultiBlockAccessor

pyvista_cad.CadMultiBlockAccessor#

class CadMultiBlockAccessor(dataset)[source]#

The .cad accessor on every pyvista.MultiBlock.

Assembly-aware: walks the hierarchy, filters by metadata, flattens, and dumps a pure-data view of the tree.

Parameters:
datasetpyvista.MultiBlock

MultiBlock this accessor is bound to.

Parameters:

dataset (MultiBlock)

Examples

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

dataset (MultiBlock)

Return type:

None

Methods

__init__(dataset)

assembly_tree()

Return a pure-data view of the MultiBlock hierarchy.

cad_view(**kwargs)

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

drop_spatial_outliers(*[, threshold, min_blocks])

Return a copy with spatial-outlier leaf blocks removed.

exact_volume()

Sum exact volume across all BREP-cached leaves.

find([predicate, name, ifc_type, layer, ...])

Filter the MultiBlock tree.

flatten()

Collapse a nested MultiBlock into a flat MultiBlock of leaves.

flatten_to_polydata()

Fuse the entire MultiBlock into one pyvista.PolyData.

plot(**kwargs)

CAD-friendly plot: shaded faces + topological edges.

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

Write the standard cad.* metadata onto this MultiBlock.

set_units(target, *[, convert])

Update cad.units on every block, optionally rescaling points.

split_by_color([color_array])

Combine and split into one block per per-cell color.

split_by_label([label_array])

Combine the assembly, then split by per-cell label value.

split_by_layer([layer_array])

Combine and split into one block per layer.

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

Re-tessellate the combined assembly from its cached 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 as a faceted build123d.Compound.

to_cadquery()

Wrap as a faceted cadquery.Workplane.

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

Write this MultiBlock as a DXF file.

to_gltf(path, /)

Write to path as a glTF / GLB file.

to_gmsh(*[, model_name])

Install this MultiBlock 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 combined assembly.

walk()

Walk the MultiBlock tree depth-first.

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.