.stl file generation with multiple tetrahedron inside cube
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i used command stlwrite but got the error
"Error using stlwrite (line 33)
Tetrahedron triangulation is not supported. "
i m trying to use this function but dont understand mistake or concept .
the variable has been uploaded .using 2nd function of stl export i get only triangle not tetra hedrons
e.g
i=1;
a=A{i};
DT3 = delaunayTriangulation(a);
nodes_file =DT3.Points ;
triangles_file=DT3.ConnectivityList ;
STL_file_name='abc.stl';
solid='defg';
[normalized_normal_vectors]=STL_Export(nodes_file, triangles_file, STL_file_name,solid);.
how to make the .stl file of tetrahedron ?
the resutls i get ..not tetrahedron but only triangles ?

0 comentarios
Respuestas (1)
DGM
el 7 de Oct. de 2025 a las 22:18
An STL file represents a triangular mesh, not a tetrahedral mesh. Accordingly, the built-in encoder and FEX #20922 will return an error if given a tetra/quad mesh. FEX #24400 will instead create a file full of jumbled useless garbage because it's a buggy mess.
Unless you have a better definition of the requirements, just use the convex hull of the vertices. Either use convhull(), or if you need the DT object for other purposes, you could use the freeBoundary() method on it to get the hull instead.
% as given
load matlab.mat
for k = 1:numel(A)
% get the surface of the convex hull
V = A{k};
F = convhull(A{k});
% write it
fname = sprintf('test_%03d.stl',k);
stlwrite(triangulation(F,V),fname)
% visualize it
patch('faces',F,'vertices',V,'facecolor','none','edgecolor','k');
view(3); view(-30,47);
axis equal; grid on; hold on
end
In this example A(end) contains a list of vertices which define the unit cube seen above. All the others are irregular clusters of vertices.
0 comentarios
Ver también
Categorías
Más información sobre Geometry and Mesh en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
