As a simple example for applying stl-files I took "cow" out of MMA example data. I'm able to discretize the Graphic without problems

kuh = ExampleData[{"Geometry3D", "Cow"}]
mesh=DiscretizeGraphics[kuh,MeshCellStyle -> {{1, All} -> Red}] (* MeshRegion *)

enter image description here

to get an stl-like triangle surface, which seems to be ok


for further meshing, but my attempt to create a volumemesh fails


What's wrong with my attempt? Thanks!

  • $\begingroup$ Just drop the RegionBoundary and it should work. $\endgroup$ – Pinti Mar 7 '19 at 11:02
  • $\begingroup$ Unfortunately no: ToElementMesh[mesh] (*$Failed*) $\endgroup$ – Ulrich Neumann Mar 7 '19 at 11:11
  • 1
    $\begingroup$ Did you know that you can just do ExampleData[{"Geometry3D", "Cow"}, "MeshRegion"]? $\endgroup$ – J. M.'s discontentment Mar 7 '19 at 11:21
  • 1
    $\begingroup$ @ Piniti Thanks, it seems to be a problem of MMA version 11.0.1 $\endgroup$ – Ulrich Neumann Mar 7 '19 at 11:23
  • 1
    $\begingroup$ However, FindMeshDefects[ExampleData[{"Geometry3D", "Cow"}, "MeshRegion"]] shows that a conversion to a volume mesh might not be straightforward. $\endgroup$ – J. M.'s discontentment Mar 7 '19 at 11:23

The cow mesh is an example of a "broken" mesh. Try

mesh =  RepairMesh[mesh]

before sending it to ToElementMesh.

Among other nice meshes, you can find a free and "clean" cow mesh also on Keenan Crane's homepage:


This is the model (without texture):

enter image description here

| improve this answer | |
  • $\begingroup$ Thanks, but nothing changes: meshR = RepairMesh[mesh ]; ToElementMesh[meshR] (*$Failed*) $\endgroup$ – Ulrich Neumann Mar 7 '19 at 11:34
  • 2
    $\begingroup$ @Ulrich, running FindMeshDefects[meshR] should show what may be causing the failure. $\endgroup$ – J. M.'s discontentment Mar 7 '19 at 11:37
  • $\begingroup$ Apparently version 11.3 can cope both with the unrepaired and the repaired mesh. So I don't know what to do. The mesh has self-intersections so tet-meshing it is nontrivial. $\endgroup$ – Henrik Schumacher Mar 7 '19 at 11:39
  • $\begingroup$ Obviously the example isn't as simple as I hoped for. Thank you Henrik and J.M. $\endgroup$ – Ulrich Neumann Mar 7 '19 at 11:41
  • 1
    $\begingroup$ @Ulrich By the way, a good and clean mesh is the "Triceratops". $\endgroup$ – Henrik Schumacher Mar 7 '19 at 11:44

As other's have stated, the issue is self intersecting facets:

mr = RepairMesh[ExampleData[{"Geometry3D", "Cow"}, "MeshRegion"]];


If we could determine if a point is 'inside' the cow, we could use a naive variant of the powercrust algorithm. Here 'inside' is not necessarily well defined.

Luckily we can use isInside defined specifically for this model here!

dm = DelaunayMesh[MeshCoordinates[mr]];

powercrust = BoundaryMesh @ MeshRegion[
  Pick[MeshCells[dm, 3], isInside /@ PropertyValue[{dm, 3}, MeshCellCentroid]]


ElementMesh[{{-0.410816, 0.410816}, {-0.133851, 0.133851}, {-0.251619, 0.251619}}, {TetrahedronElement["<" 25368 ">"]}]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.