pyvista_wasm.OBJReader#
- class pyvista_wasm.OBJReader(path: str | Path)#
Bases:
objectReader for Wavefront OBJ files (
.obj).Reads an OBJ ASCII file and produces a
Meshthat delegates parsing to VTK.wasm’svtkOBJReaderat render time. Python extracts only the vertex coordinates so that camera framing and bounding-sphere queries work before rendering.- Parameters:
path (str or Path) – Path to the
.objfile.
Examples
>>> import pyvista_wasm as pv >>> reader = pv.OBJReader("model.obj") >>> mesh = reader.read()
- __init__(path: str | Path) None#
Initialize the reader with a file path.
Methods
Attributes
Return the file path.
- property path: Path#
Return the file path.
- Returns:
The path to the OBJ file.
- Return type:
Path
- read() _OBJMesh#
Read the OBJ file and return a Mesh.
The full file content is base64-encoded and stored so that VTK.wasm can parse it at render time. Vertex coordinates are extracted on the Python side for bounding-sphere and camera-framing calculations.
- Returns:
A mesh backed by the OBJ file content.
- Return type:
Mesh
- Raises:
ValueError – If the file contains no vertex data.