pyblenderSDIC.meshes.TriangleMesh3D.to_json#

TriangleMesh3D.to_json(filename: str, description: str | None = None) None[source]#

Save the TriangleMesh3D instance to a JSON file.

The JSON file will contain the mesh data in the same format as the dictionary returned by the to_dict method.

from pyblenderSDIC.mesh import TriangleMesh3D

# Create a TriangleMesh3D instance
mesh = TriangleMesh3D(vertices=..., triangles=...)
# Save the mesh to a JSON file
mesh.to_json("path/to/mesh.json")
Parameters:
  • filename (str) – The path to the JSON file where the mesh will be saved.

  • description (Optional[str]) – A description of the mesh, by default None. This message will be included in the dictionary under the key “description” if provided.