Skip to main content
`Ctrl`+`K`

# vispy.io.mesh module

Reading and writing of data like images and meshes.

vispy.io.mesh.read_mesh(fname)

  Read mesh data from file.

  Parameters:
    fname str

      File name to read. Format will be inferred from the filename. Currently only ‘.obj’ and ‘.obj.gz’ are supported.

  Returns:
    vertices array

      Vertices.

    faces array | None

      Triangle face definitions.

    normals array

      Normals for the mesh.

    texcoords array | None

      Texture coordinates.

vispy.io.mesh.write_mesh(fname, vertices, faces, normals, texcoords, name='', format=None, overwrite=False, reshape_faces=True)

  Write mesh data to file.

  Parameters:
    fname str

      Filename to write. Must end with “.obj” or “.gz”.

    vertices array

      Vertices.

    faces array | None

      Triangle face definitions.

    normals array

      Normals for the mesh.

    texcoords array | None

      Texture coordinates.

    name str

      Name of the object.

    format str

      Currently only “obj” is supported.

    overwrite bool

      If the file exists, overwrite it.

    reshape_faces bool

      Reshape the faces array to (Nf, 3). Set to False if you need to write a mesh with non triangular faces.