Medial axis extraction from a .STL file

5 ビュー (過去 30 日間)
Surya Prakash Pandeya
Surya Prakash Pandeya 2021 年 4 月 6 日
編集済み: DGM 2025 年 6 月 22 日
How to extract a medial axis of a 3D object usng the .STL file generated from a CAD file? It would be very helpful If anyone can illustrate the process using a .STL file of a simple cylinder. and how to import those generated lines in a solid modelling software?

回答 (1 件)

darova
darova 2021 年 4 月 6 日
An example
[x,y,z] = cylinder(10);
h = surf(x,y,z);
p = surf2patch(h,'triangle');
p.facecolor = 'red';
stlwrite('test',p)
Then just open .STL file from your software
  1 件のコメント
DGM
DGM 2025 年 6 月 21 日
編集済み: DGM 2025 年 6 月 22 日
The above example uses FEX #20922. Since R2018b, MATLAB also has built-in STL read/write tools.
[x,y,z] = cylinder(10);
h = surf(x,y,z);
p = surf2patch(h,'triangle');
p.facecolor = 'red';
% built-in stlwrite() (post R2018b)
% only accepts triangulation objects
stlwrite(triangulation(p.faces,p.vertices),'test1.stl')
% Sven Holcombe's stlwrite() (part of stlTools) (2008)
% https://www.mathworks.com/matlabcentral/fileexchange/20922
% this tool can accept F,V inputs, but it can also accept other things:
stlWrite('test2.stl',p) % can accept a FV struct (from isosurface(), surf2patch(), etc)
stlWrite('test3.stl',x,y,z) % or it can accept simple gridded data
In this specific case, using the gridded data approach with #20922 doesn't work. It does work for simple height maps where there is only a single boundary curve.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSTL (STereoLithography) についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by