Getting an error message when trying to import .stl file

88 views (last 30 days)
Dear users,
I'm a Ph.D. student in Brazil/Canada researching in the domain of flow separation and I would like to ask you a question about the following error I get when I try to import a geometry with .stl extension. Hope so you can help me.
Error using pde.DiscreteGeometry
Failed to create geometry, the input does not form a closed volume. This may be due to missing faces or gaps in the input.
Error in pde.PDEModel/importGeometry (line 160) gm = pde.DiscreteGeometry(geofilename);
Thank you very much.
Matheus de Queiroz

Accepted Answer

Damian Sheehy
Damian Sheehy on 27 Jan 2017
The geometry may well have tiny gaps along an edge where two adjacent curved surfaces intersect. It may not be obvious when looking at the geometry in the parent CAD system unless it provides tools for querying and healing geometry defects. We occasionally see this problem when CAD geometry is imported from one system into another and the STL is then generated from the latter. Different CAD systems use different tolerances in their surface intersection algorithms. When the geometry is exchanged faces may not be stitched together properly, giving rise to gaps. The PDE toolbox will error if these gaps are detected on import.
If you email the STL file to me together with and any info on translation history then we can investigate; though at this point we cannot heal geometry with defects like this. email: firstname dot lastname at mathworks dot com

More Answers (2)

Brian Chen
Brian Chen on 27 Jan 2017
I get this issue as well. Any progress?
  2 Comments
michio
michio on 27 Jan 2017
Just to clarify, does the error messages not apply to your model defined in STL file that you are trying to import?
"Failed to create geometry, the input does not form a closed volume. This may be due to missing faces or gaps in the input.

Sign in to comment.


mkassa
mkassa on 13 Oct 2020
Switching from m to mm worked for me :
[F,V] = stlread('old_file_name.stl');
stlwrite('new_file_name.stl',F,V*1000)
model = createpde();
importGeometry(model,'new_file name.stl');

Community Treasure Hunt

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

Start Hunting!