File Exchange

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.

0 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 (2018). 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 .

Comments and Ratings (0)

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

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor