read
- m3sh.obj.read(filename, *args)[source]
Read from file.
Assumes an OBJ-like file structure, i.e., a text file where each line starts with a tag. Lines whose tag is contained in args are read. The returned data blocks store line data along their first axis. Data blocks are returned in the same order as given in args. If no corresponding data is found in the file the requested data block is represented as
None
.- Parameters:
- Raises:
ValueError – If any argument is not of type
str
.- Returns:
Data blocks corresponding to line tags given in args.
- Return type:
To read vertices and vertex normals from an OBJ file do
>>> v, vn = read('input-file.obj', 'v', 'vn')
Data blocks are returend as objects of type
ndarray
. This assumes that data associated with a specific tag is homogeneous. The exception being the ‘f’ tag returninglist[list[int]]
.