.stl file generation with multiple tetrahedron inside cube
    조회 수: 9 (최근 30일)
  
       이전 댓글 표시
    
 
  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
답변 (1개)
  DGM
      
      
 2025년 10월 7일 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
참고 항목
카테고리
				Help Center 및 File Exchange에서 Geometry and Mesh에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


