image thumbnail

Change scale in stl text mesh file

version 1.0.0 (1.13 KB) by JCBod Bodoque
Reads an stl flie in text format, and applies an scale factor called factor.

62 Downloads

Updated 11 Oct 2018

View License

fid=fopen('originalfiletxt.stl');
fid2=fopen('modfile.stl','w');
factor=1000;
while ~feof(fid)
tline = fgetl(fid);
disp(tline);
if(strfind(tline,'vertex')==1)
A=sscanf(tline,'%s %f %f %f');
fprintf(fid2,'%s %.14f %.14f %.14f\n','vertex',A(7)*factor,A(8)*factor,A(9)*factor);
else
fprintf(fid2,'%s\n',tline);
end


end
fclose(fid);
fclose(fid2);

Cite As

JCBod Bodoque (2022). Change scale in stl text mesh file (https://www.mathworks.com/matlabcentral/fileexchange/69082-change-scale-in-stl-text-mesh-file), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!