m3sh.hds.Mesh.

write#

Mesh.write(filename, append=False, absolute=True, quiet=False, **data)#

Write mesh to file.

Data arrays, like vertex normals and texture coordinates, can be saved by passing them as keyword arguments, see below.

Parameters:
filenamestr

If a file with this name already exists it will be overwritten unless append evaluates to True.

appendbool, optional

Append to file if it exists. When writing multiple meshes to the same file absolute should be set to False.

absolutebool, optional

Pass False to store relative indices.

quietbool, optional

Suppress console output if True.

**data

Arbitrary number of keyword arguments.

Warning

The values ‘v’ and ‘f’ may not be used as keywords since they are implicitly used when writing mesh data to an .obj file.

Notes

User defined data blocks can be written with

>>> mesh.write('output-file.obj', tag=data)

This assumes that data can be interpreted as a 2-dimensional array. The contents of each row are written to a line that starts with the given tag. If vertex normals are available, they can be stored via

>>> mesh.write('outfile-file.obj', vn=normals)

Interfacing with Blender

To properly orient a mesh when importing it in Blender, use Z as up and Y as forward direction.