Good day, I would like to seek for helps on how to convert the 3D Coordinates (x,y,z) into .STL file in MATLAB.
Below are some of the 3D Coordinates I simulated and obtained in MATLAB and stored it in a .txt file.
P =
14 0 25
16 0 20
15 4 24
10 3 6
7 5 37
5 7 3
7 0 37
3 1 37
5 1 4
...
(many more)
Note that the first column contains the x coordinates, second column contains the y coordinates and the third column contains the z coordinates.
I explored the methods below:
tri = delaunayTriangulation(P)
tetramesh(tri)
and I get the 3D Object as below:
and also
TR = delaunay(P(:,1), P(:,2);
output = trimesh(TR,P(:,1),P(:,2),P(:,3));
For both, I tried to use stlwrite() function to export it into .stl file, but unfortunately, I failed all the times.
Failed 1: tetramesh
DT = delaunayTriangulation(x,y,z);
tetramesh(DT);
Error Message:
Error using stlwrite (line 33)
Tetrahedron triangulation is not supported.
Error in Wong_STL (line 173)
stlwrite(DT,'FinalOutputTrimesh.stl')
Failed 2: trimesh
DT = delaunay(x,y,z);
trimesh(DT,x,y,z);
Error Message:
Error using stlwrite (line 25)
Input argument must be a triangulation object.
Error in Wong_STL (line 161)
stlwrite(DT,'FinalOutputTrimesh.stl')
Now, I am trying to solve as below, but I have no idea how to find T.
P = (x,y,z)
T = ??? ??? ???
TR = triangulation(T, P);
stlwrite(TR,'tritext.stl','text')
I need to know how to find T, so that I am able to export the 3D coordinates to STL file.
Could someone share his/her knowledge on how to solve this 3D Coordinates converting into .stl file problem?