read

classmethod Mesh.read(filename, *args, merge=False, quiet=True)[source]

Read mesh from file.

Read mesh combinatorics (face definitions) and vertex coordinates from an OBJ file. Additional data is read on request.

Parameters:
  • filename (str) – Name of an OBJ file.

  • *args – Variable number of arguments of type str.

  • quiet (bool, optional) – Suppress console output.

Returns:

  • mesh (Mesh) – Mesh object.

  • data (ndarray or tuple(ndarray, …)) – Data blocks as requested via args. If a data block could not be read, a None value is returned.

Vertex normals or texture coordinates stored in a file can be read via

>>> mesh, vecs, uvs = Mesh.read(filename, 'vn', 'vt')

Note

Additional return values (vertex normals, texture vertices, and custom data) are returned in the same order as they are presented in the argument list args.