def from_ply(cls, filepath): """Construct a mesh object from the data described in a PLY file. Parameters ---------- filepath : str The path to the file. Returns ------- Mesh : A mesh object. Note ---- There are a few sample files available for testing and debugging: * bunny.ply Examples -------- .. code-block:: python import compas from compas.datastructures import Mesh mesh = Mesh.from_obj(compas.get('bunny.ply')) """ ply = PLY(filepath) vertices = ply.parser.vertices faces = ply.parser.faces mesh = cls.from_vertices_and_faces(vertices, faces) return mesh
def to_ply(self, filepath, **kwargs): """Write a mesh object to a PLY file. Parameters ---------- filepath : str The path to the file. Examples -------- >>> """ ply = PLY(filepath) ply.write(self, **kwargs)
def to_ply(self, filepath, **kwargs): """Write a mesh object to a PLY file. Parameters ---------- filepath : str The path to the file. Returns ------- None """ ply = PLY(filepath) ply.write(self, **kwargs)
def from_ply(cls, filepath, precision=None): """Construct a mesh object from the data described in a PLY file. Parameters ---------- filepath : str The path to the file. Returns ------- :class:`compas.datastructures.Mesh` A mesh object. """ ply = PLY(filepath) vertices = ply.parser.vertices faces = ply.parser.faces mesh = cls.from_vertices_and_faces(vertices, faces) return mesh
def from_ply(cls, filepath, precision=None): """Construct a mesh object from the data described in a PLY file. Parameters ---------- filepath : str The path to the file. Returns ------- Mesh : A mesh object. Examples -------- >>> """ ply = PLY(filepath) vertices = ply.parser.vertices faces = ply.parser.faces mesh = cls.from_vertices_and_faces(vertices, faces) return mesh
def from_ply(cls, filepath, precision='3f'): """Construct a triangle mesh from the data in a PLY file.""" ply = PLY(filepath, precision) return cls(ply.parser.vertices, ply.parser.faces)