Home > arte3.2.0 > robots > MITSUBISHI > PA-10 > create_links_stl.m

create_links_stl

PURPOSE ^

%%%%%%%%%%%%%%%%%

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

%%%%%%%%%%%%%%%%%
   LINK 0: BASE
%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %%%%%%%%%%%%%%%%%%
0002 %   LINK 0: BASE
0003 %%%%%%%%%%%%%%%%%%
0004 filename='link0.stl'; %base
0005 cyl_radius=0.075;
0006 cyl_height = 0.290;
0007 precision = 10; % increase to obtain a more accurate drawing
0008 
0009 %create a unit height cylinder with 100 points. Radius 75
0010 [X,Y,Z] = cylinder([cyl_radius], precision);
0011 %Multiply Z by height
0012 Z=Z*cyl_height;
0013 
0014 %Save in stl format, create new file
0015 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0016 
0017 %now create a disk, bottom
0018 radius = linspace(0,cyl_radius,precision); % For ten rings
0019 theta = (pi/180)*[0:15:360]; % For eight angles
0020 [R,T] = meshgrid(radius,theta); % Make radius/theta grid
0021 X = R.*cos(T); % Convert grid to cartesian coordintes
0022 Y = R.*sin(T);
0023 
0024 %append this solid to already created file, bottom disk
0025 surf2stl(filename, X, Y, 0.*X, 'ascii', 'a+');
0026 %top disk
0027 surf2stl(filename, X, Y, cyl_height.*ones(size(X,1), size(X,2)), 'ascii', 'a+');
0028 
0029 
0030 %%%%%%%%%%%%%%%%%%
0031 %   LINK 1
0032 %%%%%%%%%%%%%%%%%%
0033 filename='link1.stl'; 
0034 cyl_radius=0.05;
0035 cyl_height = 0.150;
0036 
0037 %create a unit height cylinder with 100 points. Radius 75
0038 [X,Y,Z] = cylinder([cyl_radius], precision);
0039 % draw Z correspondingly
0040 Z(1,:)=Z(1,:) -cyl_height/2;
0041 Z(2,:)=Z(2,:).*(cyl_height/2);
0042 
0043 %Save in stl format, create new file
0044 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0045 
0046 %now create a disk, bottom
0047 radius = linspace(0,cyl_radius,precision); % For ten rings
0048 theta = (pi/180)*[0:15:360]; % For eight angles
0049 [R,T] = meshgrid(radius,theta); % Make radius/theta grid
0050 X = R.*cos(T); % Convert grid to cartesian coordintes
0051 Y = R.*sin(T);
0052 
0053 %append this solid to already created file, bottom disk
0054 surf2stl(filename, X, Y, (-cyl_height/2).*ones(size(X,1), size(X,2)), 'ascii', 'a+');
0055 %top disk
0056 surf2stl(filename, X, Y, (cyl_height/2).*ones(size(X,1), size(X,2)), 'ascii', 'a+');
0057 
0058 
0059 %%%%%%%%%%%%%%%%%%
0060 %   LINK 2
0061 %%%%%%%%%%%%%%%%%%
0062 filename='link2.stl'; 
0063 %cylinder 1
0064 cyl_radius=0.03;
0065 cyl_height = 0.1;
0066 [X,Y,Z] = cylinder([cyl_radius], precision);
0067 % draw Z correspondingly
0068 Z(1,:)=Z(1,:) -cyl_height/2;
0069 Z(2,:)=Z(2,:).*(cyl_height/2);
0070 
0071 %Save in stl format, create new file
0072 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0073 
0074 cyl_radius=0.05;
0075 cyl_height = 0.450;
0076 %draw arm, swap X and Z
0077 [Z,Y,X] = cylinder([cyl_radius cyl_radius*0.8], precision);
0078 % draw Z correspondingly
0079 X(1,:)=X(1,:) -cyl_height;
0080 X(2,:)=X(2,:).*0;
0081 
0082 %surf(X, Y, Z)
0083 
0084 %Save in stl format, create new file
0085 surf2stl(filename, X, Y, Z, 'ascii', 'a+');
0086 
0087 
0088 
0089 %%%%%%%%%%%%%%%%%%
0090 %   LINK 3
0091 %%%%%%%%%%%%%%%%%%
0092 filename='link3.stl'; 
0093 %cylinder 1
0094 % cyl_radius=0.03;
0095 % cyl_height = 0.1;
0096 % [X,Y,Z] = cylinder([cyl_radius], precision);
0097 % % draw Z correspondingly
0098 % Z(1,:)=Z(1,:) -cyl_height/2;
0099 % Z(2,:)=Z(2,:).*(cyl_height/2);
0100 %
0101 % %Save in stl format, create new file
0102 % surf2stl(filename, X, Y, Z, 'ascii', 'w');
0103 
0104 cyl_radius=0.04;
0105 cyl_height = 0.50;
0106 %draw arm, swap X and Z
0107 [X, Y, Z] = cylinder([cyl_radius cyl_radius*0.8], precision);
0108 % draw Z correspondingly
0109 
0110 Z(2,:)=Z(2,:).*(cyl_height);
0111 
0112 %Save in stl format, create new file
0113 surf2stl(filename, X, Y, Z, 'ascii', 'a+');
0114 
0115 
0116 %%%%%%%%%%%%%%%%%%
0117 %   LINK 4
0118 %%%%%%%%%%%%%%%%%%
0119 filename='link4.stl'; 
0120 
0121 cyl_radius=0.03;
0122 cyl_height = 0.07;
0123 %draw arm, swap X and Z
0124 [X, Y, Z] = cylinder([cyl_radius], precision);
0125 % draw Z correspondingly
0126  Z(1,:)=Z(1,:) -cyl_height/2;
0127  Z(2,:)=Z(2,:).*(cyl_height/2);
0128 
0129 %Save in stl format, create new file
0130 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0131 
0132 
0133 
0134 %%%%%%%%%%%%%%%%%%
0135 %   LINK 5
0136 %%%%%%%%%%%%%%%%%%
0137 filename='link5.stl'; 
0138 
0139 cyl_radius=0.03;
0140 cyl_height = 0.07;
0141 %draw arm, swap X and Z
0142 [X, Y, Z] = cylinder([cyl_radius], precision);
0143 % draw Z correspondingly
0144  Z(2,:)=Z(2,:).*(cyl_height);
0145 
0146 %Save in stl format, create new file
0147 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0148 
0149 
0150 
0151 %%%%%%%%%%%%%%%%%%
0152 %   LINK 6
0153 %%%%%%%%%%%%%%%%%%
0154 filename='link6.stl'; 
0155 
0156 cyl_radius=0.05;
0157 cyl_height = 0.01;
0158 %draw arm, swap X and Z
0159 [X, Y, Z] = cylinder([cyl_radius], precision);
0160 % draw Z correspondingly
0161  Z(1,:)=Z(1,:) -cyl_height;
0162  Z(2,:)=Z(2,:).*0;
0163 %Save in stl format, create new file
0164 surf2stl(filename, X, Y, Z, 'ascii', 'w');
0165 
0166 %now create a disk, bottom
0167 radius = linspace(0,cyl_radius,precision); 
0168 theta = (pi/180)*[0:15:360]; 
0169 [R,T] = meshgrid(radius,theta); % Make radius/theta grid
0170 X = R.*cos(T); 
0171 Y = R.*sin(T);
0172 
0173 %append this solid to already created file, bottom disk
0174 surf2stl(filename, X, Y, (-cyl_height).*ones(size(X,1), size(X,2)), 'ascii', 'a+');
0175 %append this solid to already created file, bottom disk
0176 surf2stl(filename, X, Y, 0.*ones(size(X,1), size(X,2)), 'ascii', 'a+');

Generated on Fri 03-Jan-2014 12:20:01 by m2html © 2005