필터 지우기
필터 지우기

What are the variables for STL file conversion

조회 수: 8 (최근 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 CenterFile Exchange에서 STL (STereoLithography)에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by