Wrong number of Edges/Faces after .stl-Import with fegeometry

2 views (last 30 days)
When I create a femodel-Object from an existing .stl-file, some edges/faces get lost and I don't know how/why/where. My original 3D-model looks like this:
However, when I create the femodel with
geometryFile = 'Pilz.stl';
geometryFile = fegeometry(geometryFile);
the edges from two of the four opposite faces tangent to the clyinder part of the mushroom get lost, see below picture:
I need these four faces to apply a FaceLoad later on, but F3 in this case is not just the flat area but also the two rounded faces up to the edge of F1.
I'm guessing it is not a problem with the .stl-file itself, because I've varied the width of the flat areas up to the point where the cylinder part is basically a square, but MATLAB still only recognizes 4 faces around the circumference.
How do I get MATLAB or the fegeometry function to recognize the missing Faces like so:?
Thanks in advance!

Answers (1)

Govind KM
Govind KM on 24 Jul 2025
Hi @Tim,
Thanks for sharing the STL file. I was able to reproduce the observation at my end.
The detection of these faces depends on the "FeatureAngle" property of "fegeometry". This is the threshold value for the dihedral angle between two adjacent triangles, to indicate the edge and create two separate faces, i.e. if the angle between two adjacent triangles exceeds this threshold, then that edge becomes an edge separating two faces.
This angle seems to be the outer angle between the curved missing face and the plane of F3. Setting the "FeatureAngle" property" to anything below 25 allows MATLAB to detect these faces correctly.
gm = fegeometry("Pilz.stl","FeatureAngle",20);
pdegplot(gm,FaceLabels="on");
More information on the "FeatureAngle" property can be found in the following documentation link: https://www.mathworks.com/help/pde/ug/fegeometry.html#mw_31687d20-1c0b-4db5-a071-2f9ace8077f3
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!