What are the variables for STL file conversion

5 ビュー (過去 30 日間)
Madlab
Madlab 2018 年 9 月 12 日
コメント済み: Madlab 2018 年 9 月 14 日
What are the X, Y, Z variables to use SURF2STL function? I do not have any of such variables. My goal is to create a stl file so that the model can be 3D printed. I have successfully drawn the model using surf function, but I can’t convert this to STL file.
Original file is a tiff file.
inFile = '/filepath/s04_e037_1arc_v3.tif';
% Creating figure
figure1 = figure
% Reading the tiff file
[Z,R]=geotiffread(inFile);
% Changing Z from int16 to double
Zedited = cast(Z, 'double');
% Limit lat and long for area
LATLIM=[-4.2,-2.8]
LONLIM=[36.8,38.2]
% Construct map axes for region
worldmap(LATLIM, LONLIM)
% Renaming title
title('Figure mountain','FontSize',18);
% Locating the values <= 0 for Zedited
ridzero = find(Zedited<=0);
% Changing the values of 0 to NaN in the vector
Znew=[Zedited];
Znew([ridzero]) = NaN;
% Displaying map data
geoshow(Znew, R, 'DisplayType', 'surface');
% Color the map based on the terrain elevation data, Znew.
% 888 is the number of colours used to colour from min to max elevation.
demcmap(Znew, 888);
% Resizing plot
set(gcf, 'Position', get(0, 'Screensize'));
% I want to create model! Create new figure for surface file
figure2 = figure
% More defined 3D surface to convert to STL/OBJ format for 3D printing!
surf(Znew,'EdgeColor','none','FaceColor','red')
% I do not know the X Y Z variables to convert to STL file type...
% surf2stl('modelsurf.stl',Znew,R,R)

採用された回答

KSSV
KSSV 2018 年 9 月 12 日
編集済み: KSSV 2018 年 9 月 12 日
[nx,ny] = size(Znew) ;
[X,Y] = meshgrid(1:ny,1:nx) ;
Z = Znew ;
Now you have X,Y,Z..you can write them into .stl file.
  1 件のコメント
Madlab
Madlab 2018 年 9 月 14 日
Thank you KSSV. I managed to create my STL file using the variables you suggested.

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by