101_FileIO.py 464 B

1234567891011121314151617181920
  1. import sys, os
  2. # Add the igl library to the modules search path
  3. sys.path.insert(0, os.getcwd() + "/../")
  4. import pyigl as igl
  5. from shared import TUTORIAL_SHARED_PATH
  6. # Load a mesh in OFF format
  7. V = igl.eigen.MatrixXd()
  8. F = igl.eigen.MatrixXi()
  9. igl.readOFF(TUTORIAL_SHARED_PATH + "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)