What are the variables for STL file conversion
3 views (last 30 days)
Show older comments
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)
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!