Displaying STL file with colored facets

25 Ansichten (letzte 30 Tage)
Sleh Eddine Brika
Sleh Eddine Brika am 6 Mär. 2016
Kommentiert: DGM am 8 Okt. 2025 um 21:46
I have an STL file of a part for 3D printing, for each facet I had calculated the surface roughness.How to display the STL file with the facets colored according to the value of its specific surface roughness? I want to get something like that

Akzeptierte Antwort

Ahmet Cecen
Ahmet Cecen am 6 Mär. 2016
p = patch('faces',F,'vertices',V,'FaceColor',[0.8 0.8 1.0],'FaceLighting','gouraud');
Pass the surface roughness vector as the argument to the 'FaceColor' option.
  3 Kommentare
Sleh Eddine Brika
Sleh Eddine Brika am 8 Dez. 2017
Bearbeitet: Sleh Eddine Brika am 8 Dez. 2017
Hi, it worked perfectly for me and I tried it with several complex parts. Maybe be you can try this function https://www.mathworks.com/matlabcentral/fileexchange/22409-stl-file-reader. And if you still have problems, you may try importing your CAD in IGES format using this function https://www.mathworks.com/matlabcentral/fileexchange/13253-iges-toolbox Could you please put your code.
DGM
DGM am 8 Okt. 2025 um 21:46
Since R2018b, MATLAB has built-in STL tools. You don't need to download anything.
For legacy versions still needing third-party tools, I'd strongly recommend these tools over #22409 or the decoders in #13253. This explains why.
If you use #22409 in a modern installation, you will shadow the inbuilt tools and likely cause problems for yourself unless you rename it.
I'll note that there aren't any third-party STL decoders that I know of called exactly "readstl()", but there are at least three that are some sequence of "read" and "stl" with variations of case and underscores. The most similarly-named of the three should not be expected to actually work reliably.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by