Azzera filtri
Azzera filtri

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

15 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Shubham
Shubham il 22 Feb 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!

Più risposte (0)

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by