tet_astyle.py 563 B

1234567891011121314151617
  1. """Load a tetrahedral mesh and show it in different styles."""
  2. from vedo import TetMesh, show, dataurl
  3. # Load a tetrahedral mesh from file
  4. tetm = TetMesh(dataurl + 'limb.vtu')
  5. tetm.compute_cell_size()
  6. print(tetm)
  7. # Assign a color to each tetrahedron based on the value of "chem_0"
  8. tetm.celldata.select('chem_0').cmap("Blues_r").add_scalarbar()
  9. # Make a copy of tetm and shrink the tets
  10. msh = tetm.clone().shrink(0.5).tomesh().add_scalarbar()
  11. # Show the two meshes side by side with comments
  12. show([(tetm, __doc__), (msh, "..shrunk tetrahedra")], N=2).close()