trimesh.exchange.ply module¶
- trimesh.exchange.ply.export_draco(mesh, bits=28)¶
Export a mesh using Google’s Draco compressed format.
Only works if draco_encoder is in your PATH: https://github.com/google/draco
- Parameters:
mesh (Trimesh object) – Mesh to export
bits (int) – Bits of quantization for position tol.merge=1e-8 is roughly 25 bits
- Returns:
data – DRC file bytes
- Return type:
str or bytes
- trimesh.exchange.ply.export_ply(mesh, encoding='binary', vertex_normal: bool | None = None, include_attributes: bool = True)¶
Export a mesh in the PLY format.
- Parameters:
mesh (trimesh.Trimesh) – Mesh to export.
encoding (str) – PLY encoding: ‘ascii’ or ‘binary_little_endian’
vertex_normal (None or include vertex normals)
- Returns:
export
- Return type:
bytes of result
- trimesh.exchange.ply.load_draco(file_obj, **kwargs)¶
Load a mesh from Google’s Draco format.
- Parameters:
file_obj (file- like object) – Contains data
- Returns:
kwargs – Keyword arguments to construct a Trimesh object
- Return type:
dict
- trimesh.exchange.ply.load_ply(file_obj, resolver: Resolver | None = None, fix_texture: bool = True, prefer_color: str | None = None, skip_materials: bool = False, *args, **kwargs)¶
Load a PLY file from an open file object.
- Parameters:
file_obj (an open file- like object) – Source data, ASCII or binary PLY
resolver – Object which can resolve assets
fix_texture – If True, will re- index vertices and faces so vertices with different UV coordinates are disconnected.
skip_materials – If True, will not load texture (if present).
prefer_color – None, ‘vertex’, or ‘face’ Which kind of color to prefer if both defined
- Returns:
mesh_kwargs – Data which can be passed to Trimesh constructor, eg: a = Trimesh(**mesh_kwargs)
- Return type:
dict