stlwrite(TR, filename) writes a triangulation TR to a binary STL file 'filename' in the order left to right. For example P = [2.5 8.0; 6.5 8.0; 2.5 5.0; 6.5 5.0; 1.0 6.5; 8.0 6.5];
T = [5 3 1; 3 2 1; 3 4 2; 4 6 2];
TR = triangulation(T,P);
triplot(TR)
stlwrite(TR,'tritext.stl','text')
You can execute the above code, and open tritext.stl file. You can see that the order in which the triangles are defined in tritext.stl is from left to right as shown below
You can use 'SolidIndex' name-value pair to include a vector of identification.
stlwrite(TR,'tritext.stl','text','SolidIndex',[1 4 3 2])
You can replace the last line of previous example code with the above piece of code, and open tritext.stl file. You can see that the order in which the triangles are defined, is based on the 'SolidIndex' as shown below
Best Answer