102_DrawMesh_TCP.py 577 B

12345678910111213141516171819202122232425262728
  1. import sys, os
  2. import time
  3. # Add the igl library to the modules search path
  4. sys.path.insert(0, os.getcwd() + "/../")
  5. import pyigl as igl
  6. import tcpviewer
  7. from shared import TUTORIAL_SHARED_PATH
  8. ## This is a test application for the TCPViewer
  9. # Launch the tcp viewer
  10. os.system("python ../tcpviewer.py&")
  11. # Wait for it to set up the socket
  12. time.sleep(1)
  13. # Read a mesh
  14. V = igl.eigen.MatrixXd()
  15. F = igl.eigen.MatrixXi()
  16. igl.readOFF(TUTORIAL_SHARED_PATH + "beetle.off", V, F)
  17. # Send it to the viewer
  18. viewer = tcpviewer.TCPViewer()
  19. viewer.data.set_mesh(V, F)
  20. viewer.launch()