Error using fegeometry (*.stl file read)
Show older comments
Hello,
I have been running fegeometry for some time now, importing 2D sections as .stl from Siemens NX. I ran into an instance where fegeometry errored out:
The coordinates of the input points must be finite values; Inf and NaN are not permitted.
I analyzed the .txt version of the .stl file, and it has nonzero geometry, no instances of infinite or NaN values. This is further proven when I perform an stlread(*.stl), which does not error out.
The geometry is complex, it consists of multiple faces. I am able to perform fegeometry with sections consisting of multiple faces, but this one is a doozy. I can't replicate the error elsewhere. I'll continue looking.
2 Comments
Without seeing the file, my guesses are limited. I don't have the PDE toolbox, so I have to use the forum editor. I'll note that it won't open an STL file with degenerate faces. I don't know if that's a change in error messages between versions, but a degenerate triangle will have non-finite face normals.
unzip degen.zip
% degenerate faces removed during write
gm = fegeometry('degen_cleaned.stl')
% degenerate faces included, but with zero normals
gm = fegeometry('degen_zeronorm.stl')
% degenerate faces included, but with NaN normals
gm = fegeometry('degen_infnorm.stl')
That said, R2018b stlread() will also throw an error if there are degenerate faces with non-finite normals, so that makes me doubt that it's an issue with normals (unless you're using stlread() from FEX #132048 instead of the built-in stlread()).
Some encoders will not write NaN face normals, but they'll replace them with zeros. In that case, they are pruned during import by both stlread() and fegeometry().
Again, I'm just guessing with doubt.
ZC
on 5 Aug 2025
Accepted Answer
More Answers (0)
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!