Skip to main content

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.

Usage

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("name:", parsed_object.name)
    print("total_vertices:", len(parsed_object.vertices))
    print("total_faces:", len(parsed_object.faces))
    print("total_colors:", len(parsed_object.colors))

Requirements

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

Testing

python3 -m unittest tests/test_ply_parser.py -v

Limitations

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

Contribution

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

License

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

Metadata

Release files for ply-parser 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ply-parser 2.0.0
File Size Uploaded
ply_parser-2.0.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ply-parser 2.0.0
File Interpreter ABI Platform
ply_parser-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / ply_parser-2.0.0.tar.gz

Download URL ply_parser-2.0.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
89a28f6d090b5e814574abc0f586beb2f040736613493ebeed76636f0655300d
BLAKE2b-256 checksum
How to use checksums
00069c2648c2751d75db796ef20e43f37abefb0f4ef8c3b807cf9d56f5d3a8d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / ply_parser-2.0.0-py3-none-any.whl

Download URL ply_parser-2.0.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
113928c0b4c6e134fd674019607c47bfd699775aec4e659730280209eded1f08
BLAKE2b-256 checksum
How to use checksums
99063e8191586296e39a03394c3d7ad5fccb387396d4fee4ab96d1fb1bc49719
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page