pyvista_js.OBJReader#

class pyvista_js.OBJReader(path: str | Path)#

ベースクラス: object

Reader for Wavefront OBJ files (.obj).

Reads an OBJ ASCII file and produces a Mesh that delegates parsing to vtk.js's vtkOBJReader at render time. Python extracts only the vertex coordinates so that camera framing and bounding-sphere queries work before rendering.

パラメータ:

path (str or Path) -- Path to the .obj file.

サンプル

>>> import pyvista_js as pv
>>> reader = pv.OBJReader("model.obj")
>>> mesh = reader.read()
__init__(path: str | Path) None#

Initialize the reader with a file path.

Methods

__init__(path)

Initialize the reader with a file path.

read()

Read the OBJ file and return a Mesh.

Attributes

path

Return the file path.

property path: Path#

Return the file path.

戻り値:

The path to the OBJ file.

戻り値の型:

Path

read() _OBJMesh#

Read the OBJ file and return a Mesh.

The full file content is base64-encoded and stored so that vtk.js can parse it at render time. Vertex coordinates are extracted on the Python side for bounding-sphere and camera-framing calculations.

戻り値:

A mesh backed by the OBJ file content.

戻り値の型:

Mesh

例外:

ValueError -- If the file contains no vertex data.