OFF (.off)
The Object File Format: a minimal ASCII surface format — a vertex/face/edge count header, the vertex coordinates, then one line per face (leading vertex count + indices).
| Format name | off |
| Extensions | .off |
| Read / Write | ✓ / ✓ |
| Extra dependencies | — |
Reading & writing
python
import meshioplusplus
mesh = meshioplusplus.read("surface.off")
meshioplusplus.off.write("out.off", mesh)write takes no keyword arguments.
File structure
OFF
<nverts> <nfaces> <nedges>
x y z # nverts lines
3 i j k # nfaces lines: leading vertex count (must be 3) + indicesThe first line must be exactly "OFF" (ReadError otherwise). The counts line's edge count is parsed but discarded. Every face row's leading count must be 3 — any other value raises ReadError("Can only read triangular faces").
Cell types
triangle only.
Data mapping
None — OFF carries no point_data, cell_data, or field_data; Mesh(points, cells) only.
Quirks & limitations
- Text-mode strictness: the Python reader requires a text-mode stream (raises if given bytes); the writer always opens the file itself in binary mode regardless of the caller's context.
- No boundary/edge data is ever produced — the edge count is read-and- discarded on read, and always written as
0.
Notes
- Fully handled by the C++ core.
- No reference fixture exists under
tests/meshes/off/; tests round-trip a synthetictri_meshand check.off/.0.offextension dispatch.