101_FileIO.py 459 B

123456789101112131415161718
  1. from __future__ import print_function
  2. # Add the igl library to the modules search path
  3. import sys, os
  4. sys.path.insert(0, os.getcwd() + "/../")
  5. import pyigl as igl
  6. # Load a mesh in OFF format
  7. V = igl.eigen.MatrixXd()
  8. F = igl.eigen.MatrixXi()
  9. igl.readOFF("../../tutorial/shared/cube.off", V, F)
  10. # Print the vertices and faces matrices
  11. print("Vertices: \n", V, sep='')
  12. print("Faces: \n", F, sep='')
  13. # Save the mesh in OBJ format
  14. igl.writeOBJ("cube.obj",V,F)