- stlwrite - write ASCII or Binary STL files(STLファイルへの出力)
- surf2solid - make a solid volume from a surface for 3D printing(構造体を構築する関数)
曲線をstlデータにする方法
18 views (last 30 days)
Show older comments
求めた曲線に厚みと幅を加えて,stlデータを取得したいです.
具体的に言いますと,
x=(0:pi/100:2*pi);
y=sin(x);
plot(x,y)
これでsin波を求めることができますが,このsin波の線の幅が2cm,奥行きが4cm,xの長さが6cmの,波打ってる壁のようなstlデータを取得することは可能なのでしょうか.
もし可能ならば,stlデータを作る方法を教えて頂けると幸いです.
0 Comments
Accepted Answer
michio
on 8 Aug 2019
File Exchange で公開されている関数でよさそうなものがあったのでやってみました。
使うのは以下の2つです。それぞれダウンロードしてください。
以下サンプルコードです。
n = 100; % 曲線の分割数
width = 1; % 奥行
height = 1; % 幅
% ベースとなる曲面を構築
x = linspace(0,2*pi,n); % x座標
y = linspace(0,width,n); % y座標
[X,Y] = meshgrid(x,y);
Z = sin(X); % z座標
% 厚みを加えて構造体とする
% surf2solid(X,Y,Z,'thickness',height); % 可視化用
% F(面情報) V(頂点座標)に書き出し
[F,V] = surf2solid(X,Y,Z,'thickness',-0.1);
% STL ファイルに出力
stlwrite('test.stl',F,V);
% 試しに可視化(以下はPDE Toolboxが必要です)
model = createpde(1);
importGeometry(model,'test.stl');
pdegplot(model,'FaceLabels','on')
0 Comments
More Answers (0)
See Also
Categories
Find more on STL (STereoLithography) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!