Skip to content

Add mesh.acvd.* accessor for PyVista pipelines#77

Merged
banesullivan merged 1 commit into
mainfrom
accessor-interface
May 8, 2026
Merged

Add mesh.acvd.* accessor for PyVista pipelines#77
banesullivan merged 1 commit into
mainfrom
accessor-interface

Conversation

@banesullivan

Copy link
Copy Markdown
Member

Using pyacvd today means dropping out of a PyVista pipeline to instantiate Clustering, subdivide, cluster, and rebuild. PyVista 0.48 added a dataset accessor protocol (the same pattern pandas and xarray use). This wires pyacvd into it so uniform remeshing is a one-liner:

import pyacvd  # registers ``mesh.acvd``
remesh = mesh.acvd.remesh(20000, subdivide=3)

What's exposed on pv.PolyData.acvd

  • remesh(n_clusters, *, subdivide=0, weights=None, fast=False, ...): one-shot uniform remesh. Auto-triangulates and never mutates the source mesh.
  • clustering(weights=None, *, subdivide=0): returns a configured pyacvd.Clustering for fine-grained control (plotting clusters, mixing fast/uniform, etc.).
  • cluster_ids(n_clusters, ...): per-point cluster ids without rebuilding the surface.
  • subdivide(nsub): linear subdivision returning a new PolyData.

Backwards compatibility

The classic pyacvd.Clustering API is untouched and still works on every supported PyVista version (>= 0.37). Accessor registration is gated by a hasattr(pv, "register_dataset_accessor") check, so older PyVista installs are unaffected.

The accessor is also wired up via the pyvista.accessors entry point, so mesh.acvd works without an explicit import pyacvd once the package is installed.

Notes

  • Modeled after the pyvista-manifold accessor layout.
  • README has a new "PyVista accessor (recommended)" section above the classic example.

@banesullivan banesullivan merged commit cf337d4 into main May 8, 2026
12 checks passed
@banesullivan banesullivan deleted the accessor-interface branch May 8, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant