Skip to main content

A python module that parses ascii PLY (.ply) (Polygon File Format) files. It includes a class PLYObject for storing PLY file data and a function parse_ply_file() for reading PLY files and creating PLYObject instances and can easily be customized.

Project description

PLY File Parser

This Python module provides a simple PLY (Polygon File Format) file parser. It includes a class PLYObject for storing PLY file data and a function parse_ply_file for reading PLY files and creating PLYObject instances.


PLYObject Class

The PLYObject class represents a PLY object with attributes:

name: Name of the PLY object.

vertices: List of vertex coordinates.

faces: List of face indices.

colors: List of RGB color values for vertices.

parse_ply_file Function

The parse_ply_file function takes a PLY file as input and returns a PLYObject instance. It reads the file, extracts vertex and face information, and handles color properties. If any inconsistencies or errors are detected in the PLY file, appropriate error messages are displayed.

file = "data/cube_colors.ply"
parsed_object = parse_ply_file(file)
if parsed_object:
    print("total_vertices:", len(parsed_object.vertices))
    print("total_faces:", len(parsed_object.faces))
    print("total_colors:", len(parsed_object.colors))


Python 3.11.x

PLY File Format Support

This parser currently supports PLY files with the following characteristics:

ASCII format

Vertex coordinates (X, Y, Z)

Face indices (triangles and quads)

Vertex colors


python3 -m unittest tests/ -v


The parser assumes the input PLY file follows the standard specifications. It may not handle non-standard or corrupted PLY files gracefully.


Feel free to contribute by opening issues or submitting pull requests. Bug reports, suggestions, and improvements are welcome.


This PLY file parser is licensed under the MIT License. See the LICENSE file for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ply_parser-2.0.0.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

ply_parser-2.0.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page