I have two questions.
- I have a .stl mesh file that is hollow inside. Can I change this to a solid mesh file in vtk? (e.g., Convert stl file to solid (from Magics to Solidworks or Catia)?)
Or can I save vtkpolydata as a solid mesh file?
If yes, any sample code?
- Does the .vtu extension provide the solid mesh format? (I want to use it in glvis.)
I actually wrote a small function (for vedo) where the
vtkDelaunay3D alone seems to do a very good job! (not sure how it compares to tetgen)
"""Tetralize a closed surface mesh
Click on the mesh and press ↓ or x to toggle a piece"""
from vedo import *
surf = Mesh(dataurl+'bunny.obj', c='g3').cap().smooth()
tmesh = surf.tetralize(side=0.015)
# Assign an id to each tetrahedron to visualize regions
seeds = surf.clone().subsample(0.3)
cids = 
for p in tmesh.cellCenters():
cid = seeds.closestPoint(p, returnPointId=True)
tmesh.celldata["fragments"] = cids
pieces = 
for i in range(seeds.NPoints()):
tc = tmesh.clone().threshold("fragments", above=i-0.1, below=i+0.1)
mc = tc.tomesh().color(i)
show(__doc__, pieces, axes=1)
# tmesh.write('mytetmesh.vtu') # save to disk
This is really nice ! I guess
vedo does some kind of preprocessing on the input before passing the result to
yes - to generate the internal points, and some postprocessing to prune the tets that are inside the convex hull and outside the mesh.
Thank you both for the detailed guide!!
Is it possible to use vedo in c++?
Oh if you are in c++ you better go straight to the tetgen c++ implementation as Christos indicated.