Effacer les filtres
Effacer les filtres

How can I save Matlab FEM mesh information to *.stl or *.ply

15 vues (au cours des 30 derniers jours)
Bin
Bin le 15 Fév 2024
Commenté : Bin le 23 Fév 2024
Hi omnipotent expert,
I encountered some issues after writing Matlab FEM mesh information into *.stl or *.ply then try to import it to some mesh handling software, such as Space Claim, Icem, etc. But these software can not correctly open *.stl or *.ply file from Matlab saved results. Did anybody have workful experience of transter these data to these mesh handling software or other software? Please share these experience, thank you.
Regards,
Bin

Réponse acceptée

Shubham
Shubham le 22 Fév 2024
Hi Bin,
There could be some compatibility issues when importing the mesh generated in MATLAB into other third-party software. Before exporting the mesh, try validating it first.
Remove duplicate points present in mesh. You can use the “unique” function to obtain unique rows in a matrix. Refer to the following code snippet:
% Find the unique vertices and their indices
[uniqueVertices, ~, indexn] = unique(V, 'rows', 'stable');
% Map the face indices to the new set of vertices
newFaces = indexn(F);
For more information on “unique” function, you can refer to the following documentation: https://www.mathworks.com/help/releases/R2020b/matlab/ref/double.unique.html
You can assess the quality of Mesh objects using the “meshQuality” function present in PDE toolbox documentation: https://www.mathworks.com/help/releases/R2020b/pde/ug/pde.femesh.meshquality.html?s_tid=doc_ta
Align mesh normal to point in a consistent direction using the unifyMeshNormalsFile Exchange submission: https://www.mathworks.com/matlabcentral/fileexchange/43013-unifymeshnormals
Finally, check the file format required for importing the mesh. You can write in ASCII and binary format. Refer to the following File Exchange function “stlwrite” which can be used to write in both file formats: https://www.mathworks.com/matlabcentral/fileexchange/20922-stlwrite-write-ascii-or-binary-stl-files
I hope this helps!
  1 commentaire
Bin
Bin le 23 Fév 2024
It really helps. Thank you very much Shubham, your answer solved my issue.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by