0
$\begingroup$

I want to import a 3d model to create a complete mesh of an interior model.

Subscript[c, air] = QuantityMagnitude[ThermodynamicData["Air", "SoundSpeed"]];
Subscript[ρ, air] = QuantityMagnitude[ThermodynamicData["Air", "Density"]];
bmesh = Import[FileNameJoin[{"C:\Users\sagalab\Documents\WolframMathematica\sample16.stl"}]];
λ = (c/Subscript[f, max]) /. {c -> Subscript[c, air], 
Subscript[f, max] -> 200};
h = λ/12;

mesh = ToElementMesh[bmesh, MaxCellMeasure -> {"Length" -> h}, "MeshOrder" -> 1]
Error;MeshRegion:Cell Polygon[{143,5865,138,137}] is degenerate
      
Error;ToBoundaryMesh:Mesh could not be generated

3d model link

$\endgroup$
3
  • 3
    $\begingroup$ Can not download the sample16.stl, maybe need to upload to another places. $\endgroup$
    – cvgmt
    Dec 18, 2023 at 11:07
  • $\begingroup$ It's telling you the polygon is degenerate, i.e has extremely thin triangles or two or more points on top of each other. You should process your mesh with external software like meshlab or blender to remove these offending polygons first. You could also just delete these in Mathematica, but you will likely end up with holes and artifacts in your model. $\endgroup$
    – flinty
    Dec 18, 2023 at 23:37
  • $\begingroup$ Corrected file links. $\endgroup$
    – Lewis
    Dec 19, 2023 at 5:06

1 Answer 1

3
$\begingroup$

Your input geometry has several defects:

mr = Import["sample16.stl"];
FindMeshDefects[mr]

enter image description here

I think you are best of in fixing these defects in the software that you used to create the STL file in the first place. As an alternative, you could generate the geometry in Mathematica; it's not too complicated.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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