@Sven you've been very clear, thanks. i ask an other question, to better understand.
my set of p x-y-z describes a 3D surface that i can see properly in matlab (using plot3 or trisurf), as you say.
to write the stl, I can use directly the function "stlwrite"?
Does this make a triangulation of my 3D coordinates?
In that case, which options I have to give to the function to make it works properly? because I have tried many ways, but when i give 'triangulation' it wants other options and values, and I don't know what to put into.
hi, I have a set of coordinates of a simple solid body, and I have to create finite volumes to work on. So I made a 3D Delaunay triangulation, and I have now a n-by-4 matrix with the points of resultant tetrahedron. Now, I need to create a .stl file to export this work. how do I do this? Is it possible? Because in the option There is only the voice for a triangulation in 2D. Thanks a lot.
@Sven: Thanks. It worked like a charm! It didn't work when I tried to connect it with using triangulation in stlwrite but when I used used mesh2tri to generate the faces and vertices and then used those in stlwrite, it worked! Thanks a lot again for such a quick reply!
@JD:
The issue is that your input is "gridded data" not "triangulated data" because each of x, y, z is a 20-by-20 matrix, rather than a set of vertices and triangles.
This can be handled by stlwrite (see the help file for the "triangulation" parameter), but you'll need to understand that the default "triangulation" of gridded data is a delaunayTri of the X-Y 2D data. In this sense you have repeated X-Y pairs (one at the top of the sphere, one at the bottom). The warning you're getting comes from "delaunay", not from "stlwrite".
You can overcome this by specifying how you want your gridded data triangulated:
stlwrite('test1.stl',x,y,z,'mode','ascii','triangulation','f')
Note that you'll need "mesh2tri" from http://www.mathworks.com/matlabcentral/fileexchange/28327 for this to work. I will ask Kevin for permission to include it in stlwrite (it's a small but very handy function) for a next release.
Hi! I am facing the same issues as Alexandra. I was trying to gererate surface mesh for a sphere and then converting into .stl format. When I tried to view it in Meshlab, one half of the sphere was gone. I did get a warining about duplicate data points.
Warning: Duplicate data points have been detected and removed.
Some point indices will not be referenced by the triangulation.
The commands I used are below:
[x,y,z]=sphere(20);
stlwrite('test1.stl',x,y,z,'mode','ascii');
Any help will be highly appreciated. Thanks.
Comment only
08 Apr 2013
STL File Reader
STLREAD imports geometry from a binary stereolithography (STL) file into MATLAB.
Comment only