Translate the origin of a STL file
Show older comments
I need to translate the origine of an STL. What I tried to do is to open the stl with the readstl script I found on the file exange. then I used reshape to do a 3 by n matrix with the cordinate:
X=reshape(coordinates, 3, [])';
Then I tooke of the offset I want to each point:
Y(i,:)=X(i,:)-Offset;
And generate a new STL from it with the stlwrite script also from the file exange.
stlwrite(strcat(input('Nom du fichier :','s'),'.stl'), Y(:, 1)', Y(:, 2)', Y(:, 3)', 'mode', 'ascii');
The problem I get is that when it build up the new stl is that the vertexes are in the good position according to the new origin but the facet are build "randomly" between any vertexes. (not randomly because it seems to build each time the same facet but not generate the same surface than the original file.)
I would really appreciate any help or advice about improving the my code or an other soft where it it is easier to translate the origin.
Thanks you all in advance.
stlwrite: http://www.mathworks.com/matlabcentral/fileexchange/20922-stlwrite-write-binary-or-ascii-stl-file


2 Comments
Sean de Wolski
on 5 Sep 2014
Can you post the code you're using to do the offset start to finish?
Pierrick Bersier
on 5 Sep 2014
Accepted Answer
More Answers (0)
Categories
Find more on STL (STereoLithography) in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!