import-examples/12-15-import-formats/Ip015.ply
Sources
- Pattern-mined from trimesh's own edge-case test corpus, `points_emptyface.ply` (`tests/test_ply.py`) (MIT — pattern only, no bytes copied).
Description
An ASCII PLY declares `element vertex 3` (populated with 3 coordinate rows) and `element face 0` (a legitimately empty face element — zero body rows, which is valid PLY). A loader that returns a uniform "mesh" type regardless of face count instead returns a *different* result type when there is no face data: a point cloud rather than an indexed mesh. Code written against the mesh API (assuming a `.faces` attribute exists) breaks on this input even though the file parsed without any error.
Reproducer recipe
an ASCII PLY with a populated `vertex` element and an `element face 0` header line followed by zero face body rows.
Expected kernel behavior
either always return a mesh-shaped object with `faces == []` for zero-face inputs, or document/require callers to type-check the return value; a silent type change on a `count == 0` edge is a common source of "works on every file I tested" downstream bugs.
Notes
Cross-oracle: trimesh 4.12.2 `trimesh.load()` returns a `trimesh.points.PointCloud` (not a `trimesh.Trimesh`) for this file; `PointCloud` has **no** `.faces` attribute at all, so `m.faces` raises `AttributeError: 'PointCloud' object has no attribute 'faces'` — verified 2026-07-12. Distinct from Ip013 (deferred IndexError on bad data): here the *type itself* silently changes on legitimate zero-count input, and any code assuming a uniform mesh-shaped return value breaks. Synonyms: "PLY zero face count returns PointCloud", "loader return type changes on empty element", "no faces attribute", "empty face element type trap". Provenance tier: bytes-only.
Expected validation
Provenance tier
bytes-only — defect not fully embodied in fixture bytes.
Byte assertions
contains(b'element face 0')
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ply 2format ascii 1.0 3comment Ip015 zero-count face element alongside populated vertex element (trimesh test corpus pattern, cf. points_emptyface.ply) 4element vertex 3 5property float x 6property float y 7property float z 8element face 0 9property list uchar int vertex_indices 10end_header 110.0 0.0 0.0 121.0 0.0 0.0 130.0 1.0 0.0