0001
0002
0003
0004 filename='link0_test.stl';
0005 cyl_radius=0.025;
0006 cyl_height = 0.1;
0007 precision = 40;
0008
0009
0010 [X,Y,Z] = cylinder([cyl_radius], precision);
0011
0012 Z=Z*cyl_height;
0013
0014
0015 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0016
0017
0018 radius = linspace(0,cyl_radius,precision);
0019 theta = (pi/180)*[0:15:360];
0020 [R,T] = meshgrid(radius,theta);
0021 X = R.*cos(T);
0022 Y = R.*sin(T);
0023
0024
0025 surf2stl(filename, X, Y, 0.*X, 'ascii', 'a+');
0026
0027 surf2stl(filename, X, Y, cyl_height.*ones(size(X,1), size(X,2)), 'ascii', 'a+');