m3sh.obj.

read#

read(filename, *tags, quiet=True)#

Read from OBJ file.

Read from an OBJ file, i.e., a text file where each line starts with a tag followed by numerical values. Lines whose tag is contained in tags are read. The values corresponding to a tag are returned as a list of lists: one list per tag that holds a list of numerical values per line read that start with the tag.

Parameters:
filenamestr

Name of OBJ file.

*tags

Variable number of arguments of type str.

quietbool, optional

Pass False to print comments and summary.

Returns:
datalist or tuple[list, …]

If multiple tags are specified the return value data[i] corresponds to tags[i].

Raises:
ValueError

If invalid arguments are passed via tags.

OBJError

If file parsing fails.

Examples

To read vertex coordinates and vertex normals from file do

>>> v, vn = read('input-file.obj', 'v', 'vn')

Data blocks are returned as objects of type list. You may want to convert them to ndarray.