from_OBJ#
- classmethod Mesh.from_OBJ(filename, *args, quiet=False)#
Read mesh from Wavefront OBJ file.
Added in version 1.1.0.
Read mesh combinatorics (face definitions) and vertex coordinates from an OBJ file. Additional data, like vertex normals, is read only on request, see the example below.
- Parameters:
- Returns:
Warning
This method cannot read multiple meshes from a single file! If the file defines multiples meshes they are interpreted as the connected components of a single mesh.
See also
m3sh.obj.readLow-level read function, can read non-manifold data.
Notes
By default filename (without suffix) is used as the name of the created mesh instance. If the OBJ file defines an object name it is used instead.
Examples
Vertex normals or texture coordinates stored in an OBJ file can be read via
>>> mesh, vecs, uvs = Mesh.from_OBJ(filename, 'vn', 'vt')
Additional return values (in this case vertex normals and texture coordinates) are returned in the same order as they are presented in the argument list args. If the requested data is not stored in the file a
Nonevalue is returned in its place.