0001
0002
0003
0004 filename='link0.stl';
0005 cyl_radius=0.05;
0006 cyl_height = 0.1;
0007 precision = 20;
0008
0009
0010 [X,Y,Z] = cylinder([cyl_radius], precision);
0011
0012 Z=Z*2*cyl_height-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+');
0028
0029
0030
0031
0032
0033 filename='link1.stl';
0034 cyl_radius=0.05;
0035 cyl_height = 1;
0036 precision = 20;
0037
0038
0039 [Z,Y,X] = cylinder([cyl_radius], precision);
0040
0041 X=-X*cyl_height;
0042
0043
0044 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0045
0046
0047
0048
0049
0050 filename='link2.stl';
0051 cyl_radius=0.05;
0052 cyl_height = 1;
0053 precision = 20;
0054
0055
0056 [Z,Y,X] = cylinder([cyl_radius], precision);
0057
0058 X=-X*cyl_height;
0059
0060
0061 surf2stl(filename, X, Y, Z, 'ascii', 'w');