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
0013 Z=Z*2*cyl_height-cyl_height;
0014
0015
0016 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0017
0018
0019 radius = linspace(0,cyl_radius,precision);
0020 theta = (pi/180)*[0:15:360];
0021 [R,T] = meshgrid(radius,theta);
0022 X = R.*cos(T);
0023 Y = R.*sin(T);
0024
0025
0026 surf2stl(filename, X, Y, 0.*X, 'ascii', 'a+');
0027
0028 surf2stl(filename, X, Y, cyl_height.*ones(size(X,1), size(X,2)), 'ascii', 'a+');
0029
0030
0031
0032
0033
0034
0035 filename='link1.stl';
0036 cyl_radius=0.05;
0037 cyl_height = 0.3;
0038 precision = 20;
0039
0040
0041 [Z,Y,X] = cylinder([cyl_radius], precision);
0042
0043 X=-X*cyl_height;
0044
0045
0046 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0047
0048
0049
0050
0051
0052 filename='link2.stl';
0053 cyl_radius=0.05;
0054 cyl_height = 0.05;
0055 precision = 20;
0056
0057
0058 [Z,Y,X] = cylinder([cyl_radius], precision);
0059
0060
0061 X=X*2*cyl_height-cyl_height;
0062
0063 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0064
0065
0066
0067
0068
0069 filename='link3.stl';
0070 cyl_radius=0.05;
0071 cyl_height = 0.7;
0072 precision = 20;
0073
0074
0075 [Z,Y,X] = cylinder([cyl_radius], precision);
0076
0077 X=-X*cyl_height;
0078
0079
0080 surf2stl(filename, X, Y, Z, 'ascii', 'w');