Documente Academic
Documente Profesional
Documente Cultură
Dr. G. W. Vickers
Mr. M. H. Ly
Page
Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 0.1
Laboratory 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1
Laboratory 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1
Laboratory 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1
Laboratory 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1
APPENDICES
A Start up and Initialization Procedure for the Victor CNC Machines . . . . . . . . . . . A.1
Acknowledgements
SAFETY INSTRUCTIONS
1. All work on the Victor CNC TNS-3 lathe, the Victor CNC VM-5 machining centre is
to be done under supervision.
2. Familiarize yourself with all aspects of the procedure before operating equipment. If
unsure of the correct operating procedure, request assistance from your instructor.
Demonstration
OBJECTIVE
To demonstrate the basic features and operation of the Victor numerically controlled
tools.
PROCEDURE
- Manual operation of the CNC lathe and mill including turret indexing, tail
stock motion, table motion and tool change (see Appendix B).
- Computer assisted programming for the CNC machines (see Appendix D).
Laboratory 1
CNC Lathe with Symbolic FAPT Programming
OBJECTIVES
2. To program and machine an automobile stub shaft axle using Symbolic FAPT.
REPORT
1. Start and initialize the Victor CNC TNS-3 lathe as shown in Appendix A.
4. Produce a part program for the component shown in Figure 1.1 using the
instructions given in Figure 1.2. The part is to be machined from 38 mm diameter
aluminum bar stock.
5. Execute NC data preparation and display the toolpath on the CRT screen.
1.2
2. Produce the part program for the component shown in Figure 1.3 using the
following approach:
C TG R R
3. Execute NC mode at the lathe console and machine the part as shown in
Appendix E. The component is to be made from 52 mm diameter aluminum bar
stock.
1.3
, )+
, )%+, 0)%++
, )%+, -)%++
, )!+
, )%+, 0)!++
, )%+, -)%!+, 0)22+, )++
, )%+, -).*+, 0)*+, )++, )++, )*+
, 0)*!
-3)++ 03)+++
-$)++ 0$)+++
5
'6
,
5+7+6
8 , $-).+9, -+)++, 0+)++
,
5+7+6
,
5+7+6
2+
(&
':
1$
(&
1;'
&
* #$< 41 #
&
2.1
Laboratory 2
2-axis CNC Mill with AutoCAD Data Input
OBJECTIVES
1. To operate a CNC milling machine and become familiar with set-up, procedures
and data flow.
2. To use AutoCAD to define a series of closed 2-D polygons that form initials, or
other artistic creations, within a 150 x 100 mm border. To run the output data file
through the AutoLISP program called digitize.lsp.
3. To run the tool offset program Offset.c to generate a cutter location file CLfile.
4. To run the G-code file Gcodehp.c to generate machine code.
5. To set-up and machine the 2-D shape in plexiglass plate with a inch (6.35 mm)
diameter ball-mill on the Victor CNC Machining Center using the program
CNC.exe.
REPORT
The report should include the AutoCAD polygon drawing and the Matlab drawing with
the cutter-offset path. Also it should include a flow chart of the program operation
sequence and a brief assessment of the limitations of the cutter offset program.
Marks for the lab will be based upon completeness of objectives and creativity of
application in the lab report. The report will be due in class at a designated date that will
be prior to the lab #2 session. Because of the interlocking lab schedule, late reports will
not be accepted for marking.
Note: While the actual machining time is not great you should use the opportunity to
investigate the CNC machine set-up and controller operations. In subsequent labs part of
the lab mark will be given for the amount of assistance required to set-up and machine
the part.
PROCEDURE
(All the program for this Lab can be found in Windows NT server
\\designsv1\courses\mech460\lab2)
Start AutoCAD to create initial and then use AutoLISP program called digitize.lsp to
output points data for input to program offset.c.
Study the tool offset program, which determines the position of an end mill cutter in
relation to a 2-D curve defined by discrete points.
1. Understand data structure of the input (CP.DAT) and output file (CP.LOC).
2. Run program offset in DOS Window to get output file. Enter 3.175 mm for tool
radius, 1 for processing curve number 1, 1 for processing curve number 2 and 0
for processing curve number 3. Compare your output with the example output
called CP.LOC.
3. Display CP.DAT and CP.LOC to make sure the tool path is correct. To get the
output Figure 2.2 using command:
D:> start up matlab from window
drawtp
Please Input the Design Data of the Part: cp.dat
Do you want to show the cutter location?(y/n): y
Please Input the offset Data of the Part: cp.loc
2.4
80
70
60
50
y
40
30
20
10
0 20 40 60 80 100 120 140
x
Study the machining program, which converts a cutter location file to a G-code file.
1. Understand data structure of the input data (CP.LOC) and output file (CP.GCD).
2. Run program gcodehp in DOS Window to get gcode output file. Enter (0,0,100)
for home position, 200 for feed rate, 1200 for spindle speed, 20 for Z safety and
(-3.00) for depth of cut.
3. Examine the gcode output file CP.GCD.
B) Create and machine your own series of closed 2-D polygons to form initials or
other artistic creation.
2.5
;===============================================================
; ADD CURRENT POINT TO LIST OF POINTS FOR OBJECT
;===============================================================
(setq NewOb (reverse NewOb))
(setq NewOb (cons NewPt NewOb))
(setq NewOb (reverse NewOb))
)
2.6
;===================================================================
; ADD OBJECT TO LIST OF OBJECTS?
;===================================================================
(setq AddOb (getstring "Add this object to the list of objects? (Y/N):
"))
(if (or (= AddOb "Y") (= AddOb "y"))
(prong
;==============================================================
; ADD CURRENT OBJECT TO LIST OF OBJECTS
;==============================================================
(setq ObList (reverse ObList))
(setq ObList (cons NewOb ObList))
(setq ObList (reverse ObList))
)
)
;====================================================================
; WRITE OBJECTS TO FILE?
;====================================================================
(setq SaveOb (getstring "Save list of objects to a file? (Y/N): "))
(if (or (= SaveOb "Y") (= SaveOb "y"))
(progn
;=============================================================
; GET FILE NAME FROM USER
;=============================================================
(while (= FD nil)
(setq FName (getstring "File name: "))
(setq FD (open FName "w"))
)
;=============================================================
; WRITE NUMBER OF OBJECTS TO FIRST LINE OF FILE
;=============================================================
(setq NObs (length ObList))
(write-line (itoa NObs) FD)
;=============================================================
; WRITE DATA FOR EACH OBJECT TO FILE
;=============================================================
(setq i 0)
(repeat NObs
(setq PtList (nth i ObList))
;==========================================================
; WRITE NUMBER OF POINTS IN CURRENT OBJECT TO FILE
;==========================================================
(setq NPts (length PtList))
(write-line (itoa NPts) FD)
(setq j 0)
(repeat NPts
(setq Pt (nth j PtList))
;=======================================================
; WRITE CURRENT POINT COORDINATES TO FILE
;=======================================================
2.7
(setq XCoord (car Pt))
(setq YCoord (cadr Pt))
(setq FLine (strcat (rtos XCoord)" " (rtos YCoord) " 4.0"))
(write-line FLine FD)
(setq j (+ j 1))
)
(setq i (+ i 1))
)
(close FD)
)
)
)
Offset program
/****************************************************************************/
/* Program offset.c : to calculate the tool center coordinates */
/* for a tool of radius R moving along a curve defined by discrete point. */
/* Algorithm: */
/* calculate 2 vector unit at a given point then add these vector */
/* calculate dot vector to find angle between 2 vectors */
/* calculate cross product to find direction of the normal vector */
/* Limitation: ??? */
/* Input data format ( clockwise) */
/* number lines */
/* number points of each line */
/* x y z */
/* Output data format */
/* 1 (penup) or 0 (pen down) x y z */
/* */
/****************************************************************************/
#include <stdio.h>
#include <math.h>
/****************************************************************************/
/* Main Program */
/****************************************************************************/
main()
{
int numpts, numobj;
char inputf[80], outputf[80];
FILE *fopen(), *fp1, *fp2;
float cutterR,radius;
float xin[max], yin[max], z;
float xout[max], yout[max];
int i, j, side;
/**************************************************************************/
/* Get input and output files and tool radius */
/**************************************************************************/
2.8
/************************************************************************/
/* Process each polygon */
/************************************************************************/
fscanf(fp2,"%d\n",&numobj);
for ( j=1; j<numobj+1; ++j)
{
printf("Processing curve number #%3d \n", j);
printf("Enter 0 = machine INSIDE the curve \n");
printf(" 1 = machine OUTSIDE the curve \n");
scanf("%d",&side);
if (side == 0)
cutterR = -radius; /* change sign of the cutter */
else
cutterR = radius;
/**********************************************************************/
/* Read input data file and store into array begining with index 1 */
/**********************************************************************/
fscanf(fp2,"%d\n", &numpts);
for ( i=1; i<numpts+1; ++i)
{
fscanf(fp2,"%f %f %f\n",&xin[i], &yin[i], &z);
}
/* check to see if the date file close or open */
/* if open, close it and increased the pointer */
if (xin[1] == xin[numpts])
{
xin[0] = xin[numpts-1];
yin[0] = yin[numpts-1];
}
else /* curve points open. close it and add one more point */
{
xin[0] = xin[numpts];
yin[0] = yin[numpts];
xin[numpts+1] = xin[1];
yin[numpts+1] = yin[1];
numpts = numpts +1;
}
/***********************************************************************/
/* Calculate offset by calling subroutine loc_coord */
/***********************************************************************/
loc_coord(cutterR, xin, yin, xout, yout,numpts);
2.9
/***********************************************************************/
/* Write output to the cutter location file */
/***********************************************************************/
fprintf(fp1, "1 %9.4f %9.4f %9.4f \n",xout[1],yout[1],z);
for ( i =2; i< numpts; i++)
fprintf(fp1, "0 %9.4f %9.4f %9.4f \n",xout[i],yout[i],z);
fprintf(fp1, "0 %9.4f %9.4f %9.4f \n",xout[1],yout[1],z);
}
fclose(fp2);
fclose(fp1);
}
/*==========================================================================*/
/* Subroutine calculates cutter location for each closed polygon */
/* Given tool radius (rad), xpt, ypt and numpts */
/* Return xoff and yoff */
/*==========================================================================*/
void loc_coord(rad,xpt,ypt,xoff,yoff,numpts)
float rad;
float xpt[], ypt[], xoff[], yoff[] ;
int numpts;
{
#define x 0
#define y 1
int k;
float vec1[2], vec2[2];
float unitvec1[2], unitvec2[2];
float plus[2], normplus[2];
float crossab,scaled, theta,temp,t1,t2;
if (crossab < 0 )
{
plus[x] = -plus[x];
plus[y] = -plus[y];
}
/* offset point */
xoff[k]=xpt[k]+(scaled*normplus[x]);
yoff[k]=ypt[k]+(scaled*normplus[y]);
}
}
2.11
Gcode program
/**************************************************************************/
/* Program gcodehp.c : to convert a cutter location file to gcode for */
/* for CNC machine */
/* Input file: cutter location with format 1 or 0 x y z */
/* Output file: G-cdoe file */
/**************************************************************************/
#include <stdio.h>
/***********************************************/
/* Main Program Routine */
/***********************************************/
main()
{
printf("Please enter the name of the input file name : \n");
scanf ("%s", inputf);
fp2=fopen(inputf, "r");
if (fp2 == NULL) printf("ERROR IN OPENING INPUT FILE !!\n");
/***********************************************/
/* WRITE INITIAL DATA */
/***********************************************/
num = 1;
fprintf(fp1,"O23; \n");
fprintf(fp1,"N%4d G92 X%8.3f Y%8.3f Z%8.3f; \n",num, xx, yy, zz);
num = num + 1;
if (datafrmt == 0)
fprintf(fp1,"N%4d G20; \n", num);
if (datafrmt == 1)
fprintf(fp1,"N%4d G21; \n", num);
num = num +1;
fprintf(fp1,"N%4d G90; \n", num);
num = num +1;
fprintf(fp1,"N%4d G00 Z%8.3f F%5.1f; \n", num, zsafe, feedrate);
num = num +1;
fprintf(fp1,"N%4d S%5.0f M03; \n", num, spinspd);
num = num +1;
/***********************************************/
/* READ TOOL PATH DATA */
/***********************************************/
while (!feof(fp2))
{
fscanf (fp2,"%d %f %f %f", &up_dwn, &xin, &yin, &zin);
if (up_dwn == 1)
{
fprintf(fp1,"N%4d G00 Z%8.3f; \n",num, zsafe);
num = num +1;
fprintf(fp1,"N%4d G00 X%8.3f Y%8.3f; \n",num, xin, yin);
num = num +1;
fprintf(fp1,"N%4d G01 Z%8.3f F%5.1f; \n",num, zdeep, feedrate);
num = num +1;
}
if (up_dwn == 0)
{
fprintf(fp1,"N%4d G01 X%8.3f Y%8.3f; \n",num, xin, yin);
num = num +1;
}
}
fprintf(fp1,"N%4d G00 Z%8.3f; \n", num,zz);
num = num +1;
fprintf(fp1,"N%4d G00 X%8.3f Y%8.3f; \n",num, xx, yy);
num = num +1;
fprintf(fp1,"N%4d M05; \n",num);
num = num +1;
fprintf(fp1,"N%4d M30; \n",num);
fprintf(fp1,"%% \n");
fclose(fp1);
fclose(fp2);
}
2.14
Laboratory 3
3-axis CNC Mill with 3 & 5-axis Pro/ENGINEER Cutter Path
Planning
OBJECTIVES
1. To operate a 3-axis CNC milling machine and become familiar with set-up,
procedures and data flow.
2. To complete the Pro/ENGINEER demonstration of surface, workpiece and tool
path generation for two intersecting quarter cylinders given in Procedure A).
3. To use Pro/ENGINEER to generate a similar size and shape object, fitting within
a 65 x 65 x 50 mm size workpiece, with an intersecting quarter cylinder and
quarter cone.
4. To use Pro/ENGINEER to produce the most efficient tool paths for 3- and 5-axis
roughing and finishing operations. Use Surface Mill to create graphical tool paths
for a inch diameter end-mill cutter. The curved surface-machining programs
should not exceed an estimated time in Pro/E of 30 minutes. The actual
machining time will be significantly longer than this.
5. To output a 3-axis cutter location file for roughing and finishing operations, and
generate G-code files using the postprocessor program given in Appendix H.
6. To set-up and machine the defined shape in a block of Ren 450 model making
material on the 3-axis Victor CNC machining center.
REPORT
The report should include Pro/E drawings of the intersecting quarter cylinder and quarter
cone with at least two different tool paths for each of 3- and 5-axis finishing operations.
It should also include the reasons for selecting the final 3-axis roughing and finishing
operations as well as the Pro/E estimated machining time.
Marks for the lab will be based primarily upon completeness of objectives in the lab
report, as well as on the amount of assistance required to set-up and machine the
component. The report will be due in class at a designated date that will be prior to the
lab #3 session. Because of the interlocking lab schedule, late reports will not be accepted
for marking.
3.2
PROCEDURE
Index
A) Demonstration of the tool path generation using Pro/ENGINEER p 3.2
Step 1: Produce the surface p 3.2
Step 2: Create the workpiece p 3.8
Step 3: Perform the 3-Axis machining operation setup p 3.10
Step 4: Define the 3-Axis machining operations p 3.13
4.1 Define mill window for first cut (rough cut)
4.2 Define the second cut (finishing Cut)
Step 5: Perform 5-axis machining operation setup p 3.20
Step 6: Create the NC code p 3.24
B) Use Pro/ENGINEER to generate an intersecting quarter cylinder and quarter
cone and machine the defined shape in Ren 450 model making material on a 3-
axis CNC machine.
Procedure Start
A) Demonstration of the tool path generation using Pro/ENGINEER (Pro/E)
Step 1: Produce the surface. The surface consists of two quarter of cylinders intersected,
together form a surface (65 x 65 x 40mm) as shown in Figure 3.18.
1. Start the Pro/E program. Windows menu items, Start Programs PTC25
Pro ENGINEER Click on the icon Pro ENGINEER.
2. Set working directory. File Set Working Directory, select working
directory.
3. Create the part name. Pro/E main menu, File New, select Part in the New
window, enter part name: lab3.
4. Start of the part. The part contains some features already. The main graphics
area shows 3 datum planes and a coordinate system as shown in Figure 3.1.
3.3
Click on Surface icon first and then click on the placement on the extrude
dashboard (Figure 3.3) and select define. The sketch dialog window
appears as shown in Figure 3.4.
Choose Create Arc by picking its center and end points icon on Sketcher
Toolbar (Figure 3.6) to sketch a quarter of circle for extrusion in plane
FRONT by clicking on the center of the default origin and draw a quarter
of circle the drawing windows. Click middle mouse to finish drawing the
rectangle.
Modify the dimensions to 40mm by double clicking on the dimensions on
the arc. To end sketching choose Accept icon on Sketcher Toolbar
(Figure 3.6) and click OK in the Section dialog.
Extrude the arc to form the quarter of cylinder. Enter depth value as 65mm
into the depth field of the extrude dashboard (Figure 3.3) and click the
Accept tick to finish (Figure 3.7).
View the surface as shown in Figure 3.8. View Orientation Standard
Orientation.
3.5
6. Create another quarter of cylinder with radius of 30mm and length of 65mm.
(using previous instruction 5)
Choose the datum place RIGHT as sketch plane.
Draw a quarter of circle as shown in Figure 3.9.
Extrude the arc to 65mm.
The intersected surface is given in Figure 3.10.
Figure 3.9 Draw 30mm arc. Figure 3.10 Two intersected surfaces
Trim 2nd surface. EDIT TRIM or pick the trim icon to cut out the
surface behind 1st surface. Pick 2nd surface as trimmed quilt and edge as
trimming object shown in Figure 3.14 and Figure 3.15.
Merge two surfaces to one surface. Select 1st surface and then hold down
Ctrl key to select 2nd surface until 2 both surfaces highlighted. Select the
merge tool as shown in the Figure 3.17 to merge two surfaces to form one
surface as shown in Figure 3.18.
Step 2: Create the workpiece. The workpiece represents the raw stock of material from
which the surf will be machined. Pro/E refers to this procedure as an assembly operation.
1. Start the Pro/E program. Windows menu items, Start Programs PTC25
Pro ENGINEER Click on the icon Pro ENGINEER.
2. Set working directory. File Set Working Directory, select working
directory.
3. Create the part name. Pro/E main menu, File New, select Manufacturing in
Type window and NC Assembly in Sub-type window, enter name: mfglab3 as
shown in Figure 3.19
4. Load the part. From MANUFACTURE menu, select Mfg Model Assemble
Ref. Model (Figure 3.20 and 3.21). Select Lab3.prt in the open window.
The component Placement window pops up. Select to place the part at
default location as shown in Figure 3.22. Click OK to close Component
Placement windows as shown in Figure 3.23.
3.9
5. Create a datum plane ADTM1. Select to create a new datum plane offset
-8.00mm of NC_ASM_FRONT plane as shown in Figure 3.24.
Step 3: Perform the 3-Axis machining operation setup. The setup consists of defining the
type of machine to use. It also requires defining a coordinate system if one does not
already exist and a retraction plane for the cutting tool. The coordinate system must
match the mill orientation and the part zero.
Step 4: Define the 3-Axis machining operations. The setup consists of defining the type
of tool to use and machining parameters (tools size, cutting speed, etc.), and specify the
volume of material to be removed.
5. MFG PARAMS Set. Param Tree window pops up. Input or change the
values as shown in Figure 3.38. File save parameters to file called
milprmRcut Exit and DONE.
Figure 3.38
3.15
Pick on each of the top edges of the workpiece as shown in Figure 3.42.
Select Done and OK and mill windows was defined.
Figure 3.42
3.16
Select Tool Side and change to Tool Past as shown in Figure 3.43. Make
sure tool machine to outside of the surface.
Figure 3.43
9. After this completes choose DONE SEQ. If you dont do this, you are
likely to lose the definition of this NC sequence.
10. Modify cutting direction. NC Sequence Select Rcut. From SEQ SETUP,
check Define Cut Done. Change Cut Angle to 90 as shown in Figure 3.46.
The cutting path is shown in Figure 3.47.
11. Cut Angle 45 as shown in Figure 3.48 and the cutting path is shown in Figure
3.49.
Figure 3.50
11. Modify Cut Type. Select From Surface Isolines. Highlight each surface as in
Figure 3.55 to make sure the cutting direction as in Figure 3.56. Run NC
Check to display tool path as shown in Figure 3.57.
3.20
Figure 3.57
1. MFG Setup Operation. File New and Operation Setup window pops up
automatically as shown in Figure 3.58.
2. Define NC machine. Click NC machine icon in Figure 3.27, Machine
Tool Setup windows pop up as shown in Figure 3.28. Enter the parameters as
shown below:
Machine name: Hass
Machine type: Mill
Number of Axes: 5 Axis
CNC control: VMC
3.21
Figure 3.60
3.22
11. Define Mill surface. Surf Pick Mill Surface Done. Select the surface as
shown in Figure 3.61 and Okay. Select all and done.
Figure 3.61
12. Cut Direction window pops up. Select OK to accept the default (Figure 3.62)
13. View tool path. Machining NC Sequence Play Path NC check. The
cutting path is shown in Figure 3.63.
16. Modify Cut type. Select from the Surface Isolines as shown in Figure 3.66 and
cutting path is given in Figure 3.67.
Figure 3.68
19. Highlight two NC sequences to display cutter paths on one screen. Tools
NC check. The cutting path is given in the Figure 3.69
Figure 3.69
Figure 3.70
4. The rcut.ncl and rcut.gcd file should be open with program wordpad to edit.
Edit the beginning and the end of the gcode file so that it works on the Victor
Machining Center as shown below:
0111;
G90 G21; (Absolute, mm)
G92 X0.0 Y0.0 Z100.0; (Set home position)
S1200 M03; (Set spindle speed and switch on)
G00 X 71.194 Y 66.400 Z 10.000;
F 400.000;
G01 X 71.194 Y 66.400 Z 0.000;
G01 X -6.194 Y 66.400 Z 0.000;
.......
G01 X 46.143 Y -1.400 Z -40.000;
G01 X 46.143 Y -1.400 Z 10.000;
G00 X0.0 Y0.0 Z100.0; (Return home)
M05: (Set spindle off)
M30; (End of program and rewind)
%
Laboratory 4
3-axis CNC Curved Surface Machining and Error
Measurement
OBJECTIVES
REPORT
The report should include the CAD drawings, with CAM drawings for at least two
different tool paths for each of 3- and 5-axis finishing operations. It should also include
the reasons for selecting the final 3-axis roughing and finishing operations, the estimated
machining time, and the error between the analytical and machined surfaces.
4.2
Marks for the lab will be based primarily upon completeness of objectives and creativity
of application as well as on the amount of assistance required to set-up and machine the
component.
PROCEDURE
Index
A) Demonstration of surface machining and engraving using Pro/ENGINEER
Step 1: Plot a mathematical surface and generate control points using Matlab p 4.2
Step 2: Produce the surface using Pro/E p 4.6
Step 3: Create the workpiece p 4.8
Step 4: Perform the manufacturing setup p 4.10
Step 5: Define the machining operations p 4.11
5.1 Define mill window for first cut (rough cut) p 4.11
5.2 Define the second cut (Finishing Cut) p 4.13
Step 6: View tool path simulation and create the NC code p 4.14
Step 7: Engrave 2-D shape on to the surface p 4.15
B) Machine the finished workpiece in Ren 450 model making material p 4.17
C) Measure the machined surface and compare with the analytical surface using a
CMM
p 4.17
Procedure Start
A) Demonstration of surface machining and engraving using Pro/ENGINEER
[( x y 2 ) 2 + y 2 ]
Step 1: Plot the surface z = xe and generate control points using Matlab.
1. Start up matlab and using the following functions to plot the surface as shown
in Figure 4.1.
>> [x,y]=meshgrid(-2:.1:2);
>> z=x.*exp(-((x-y.^2).^2+y.^2));
>> mesh(x,y,z),xlabel('X'),ylabel('Y'),zlabel('Z')
4.3
0.5
0
Z
-2
-0.5
2 -1
1
0
0
1
-1
Y
-2 2
X
Figure 4.1
z=
Columns 1 through 6
Columns 7 through 9
3. Generate another 9 control points for y = -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5
and 2.0.
Lab4.ibl
open Arclength
Begin section !1
Begin curve !1
1 -2.0 -2.0 0.0
2 -1.5 -2.0 0.0
3 -1.0 -2.0 0.0
4 -0.5 -2.0 0.0
5 0.0 -2.0 0.0
6 0.5 -2.0 0.0
7 1.0 -2.0 0.0
8 1.5 -2.0 0.0
9 2.0 -2.0 0.0
Begin section !2
Begin curve !1
1 -2.0 -1.5 0.0
2 -1.5 -1.5 0.0
3 -1.0 -1.5 0.0
4 -0.5 -1.5 0.0
5 0.0 -1.5 0.0
6 0.5 -1.5 0.0025
7 1.0 -1.5 0.0221
8 1.5 -1.5 0.0901
9 2.0 -1.5 0.1980
Begin section !3
Begin curve !1
1 -2.0 -1.0 -0.0001
2 -1.5 -1.0 -0.0011
3 -1.0 -1.0 -0.0067
4 -0.5 -1.0 -0.0194
5 0.0 -1.0 0.0
6 0.5 -1.0 0.1433
7 1.0 -1.0 0.3679
8 1.5 -1.0 0.4298
9 2.0 -1.0 0.2707
Begin section !4
Begin curve !1
1 -2.0 -0.5 -0.0099
2 -1.5 -0.5 -0.0546
3 -1.0 -0.5 -0.1632
4 -0.5 -0.5 -0.2219
5 0.0 -0.5 0.0
6 0.5 -0.5 0.3658
7 1.0 -0.5 0.4437
8 1.5 -0.5 0.2449
9 2.0 -0.5 0.0728
Begin section !5
Begin curve !1
1 -2.0 0.0 -0.0366
2 -1.5 0.0 -0.1581
3 -1.0 0.0 -0.3679
4 -0.5 0.0 -0.3894
4.5
5 0.0 0.0 0.0
6 0.5 0.0 0.3894
7 1.0 0.0 0.3679
8 1.5 0.0 0.1581
9 2.0 0.0 0.0366
Begin section !6
Begin curve !1
1 -2.0 0.5 -0.0099
2 -1.5 0.5 -0.0546
3 -1.0 0.5 -0.1632
4 -0.5 0.5 -0.2219
5 0.0 0.5 0.0
6 0.5 0.5 0.3658
7 1.0 0.5 0.4437
8 1.5 0.5 0.2449
9 2.0 0.5 0.0728
Begin section !7
Begin curve !1
1 -2.0 1.0 -0.0001
2 -1.5 1.0 -0.0011
3 -1.0 1.0 -0.0067
4 -0.5 1.0 -0.0194
5 0.0 1.0 0.0
6 0.5 1.0 0.1433
7 1.0 1.0 0.3679
8 1.5 1.0 0.4298
9 2.0 1.0 0.2707
Begin section !8
Begin curve !1
1 -2.0 1.5 0.0
2 -1.5 1.5 0.0
3 -1.0 1.5 0.0
4 -0.5 1.5 0.0
5 0.0 1.5 0.0
6 0.5 1.5 0.0025
7 1.0 1.5 0.0221
8 1.5 1.5 0.0901
9 2.0 1.5 0.1980
Begin section !9
Begin curve !1
1 -2.0 2.0 0.0
2 -1.5 2.0 0.0
3 -1.0 2.0 0.0
4 -0.5 2.0 0.0
5 0.0 2.0 0.0
6 0.5 2.0 0.0
7 1.0 2.0 0.0
8 1.5 2.0 0.0
9 2.0 2.0 0.0
4.6
Step 2: Produce the surface using Pro/E. The part consists of 81 control points, together
forming a surface (4 x 4 x 1) as shown in Figure 4.4.
5. Create a 4 x 4 x 1 surface.
Insert menu Advanced Blend from file Surface. Select default
Coord system PRT_CSYS_DEF. Enter file Name: lab4.ibl. Choose
default arrow for Material Side. Click ok button in figure 4.2.
View Model Setup Mesh Surface Meshing spacing. Select
current surface and enter 50 for 1st direction and 2nd direction as shown in
figure 4.3. The surface will display as shown in Figure 4.4.
Save the part. File Save and Exit.
Figure 4.4
4.8
Step 3: Create the workpiece. The workpiece represents the raw stock of material from
which the part will be machined. Pro/E refers to this procedure as an assembly operation.
1. Start the Pro/E program. Windows menu items, Start Programs PTC25
Pro ENGINEER Click on the icon Pro ENGINEER.
2. Set working directory. File Set Working Directory. Select working
directory.
3. Create the part name. Pro/E main menu, File New, select Manufacturing in
New window and NC Assembly in Sub-type window, enter name: mfglab4.
4. Load the surface. From MANUFACTURE menu, select Mfg Model
Assemble Ref Model. Select lab4srf in the pop up window and place the
surface at default location.
5. Create a datum plane. Select to create a new datum plane offset 0.75 of
NC_ASM_FRONT plane as shown in Figure 4.5.
Figure 4.5
4.9
Figure 4.6
Figure 4.7
4.10
Step 4: Perform the manufacturing setup. The setup consists of defining the type of
machine to use. It also requires defining a coordinate system if one does not already exist
and a retraction plane for the cutting tool. The coordinate system must match the mill
orientation and the part zero.
Figure 4.8
4.11
Step 5: Define the machining operations. The setup consists of defining the type of tool
to use and machining parameters (tools size, cutting speed, etc.), and specify the volume
of material to be removed (created in the previous step).
5.1 Define mill window for the first cut (Rough Cut)
1. Machining NC Sequence Machining Surface Mill 3 Axis
Done.
2. SEQ SETUP window pops up. Ensure that Name, Tool, Parameters, Window,
Define cut are checked and then close DONE.
3. Enter NC Sequence name. Type the name as RoughCut.
4. Tool setup table pops up. Input or change the parameter to the following
values:
Cutter_Diam 0.5 (1/2 diameter end mill)
Length 3
Corner Radius 0.0 (Flat end mill)
5. MFG PARAMS Set and enter the values as shown in Figure 4.9 then File
Exit DONE.
Figure 4.9
4.12
Figure 4.12
After this completes choose DONE SEQ. If you dont do this, you are likely
to lose the definition of this toolpath!
4.13
Figure 4.13
4.14
Figure 4.14
Step 6: View combination tool path simulation and create the NC code.
Figure 4.15
Figure 4.16
Figure 4.21
B) Machine the finished workpiece in Ren 450 model making material.
C) Measure the machined surface and compare with the analytical surface using a
CMM.
Appendix A
Start Up and Initialization Procedure
for the Victor CNC Machines
CNC TNS-3 LATHE CNC VM-5 MILLING MACHINE
2. Set all OVERRIDE SWITCHES and SPIN- 2. Set all OVERRIDE SWITCHES to OFF.
DLE SPEED to OFF and close lathe door.
3. Set MODE to ZRN and select NC opera- 3. Set MODE to ZRN.
tion.
Set AXIS SELECT to Z/Y/X/A.
Shift jog lever to +X and +Z.
Hold MANUAL FEED in `+' direction un-
Hold jog lever until ZRN light is on. til ZRN light is on.
Note: Check that turret is away from the Note: Check that the table is away from
zero return position before commencing #3. the zero return position before commencing
#3.
4. Set MODE to: 4. Set MODE to:
MANUAL/MDI/TAPE/MEMORY/EDIT for MANUAL/MDI/TAPE/MEMORY/EDIT for
NC operation or otherwise select FAPT op- NC operation or EDIT for CONVERSA-
eration. TIONAL programing.
5. Turn Power Supply OFF 5. Turn Power Supply OFF.
Reverse of #1. Reverse of #1.
Appendix B
Manual Operation of the CNC TNS-3
Lathe
N210 G00 X Z return to intermediate N210 G91 G28 Z0. Z return home, spindle
position M05 o
N220 T0800 tool oset cancel N220 M30 end of program and
N230 M01 optional stop rewind
N240 M05 spindle o N230 % end of tape.
N250 M30 end of program and
rewind
N260 %: end of tape.
Appendix G
Available G-codes
a) CNC TNS-3 LATHE
/**********************************************************************/
/* P O S T P R O . C */
/**********************************************************************/
#include<stdio.h>
#include<math.h>
/**********************************************************************/
main()
/**********************************************************************/
{
/*-----------------------------------------------------------------*/
/* DEFINE VARIABLES USED */
/*-----------------------------------------------------------------*/
int direct,i,j;
int cir_fg,fedrate_fg,from_fg;
int intol_fg,outtol_fg,spind_fg,unit_fg;
float x,y,z;
float x_prev,y_prev,z_prev;
float xprev,yprev,zprev;
float xdumc,ydumc,zdumc;
float from_x,from_y,from_z;
float x_cir_ctr,y_cir_ctr,z_cir_ctr;
float x_cir_start,y_cir_start ;
float theta_start,cir_rad;
float feed_rate,spind_rpm,in_tol,out_tol,tool_no;
float px,py,xprod,sx,sy;
double atan(),sqrt(),fabs();
double theta1,theta2,rad1,radlow,radhigh;
double xtest,ytest,ztest;
char c,gcodefn[80],aptfn[80];
char pname[10];
char unit_type[6];
char spind_direct[3];
char cool_state[3];
char dum[4];
char cmd[4];
char previous_cmd[80];
char dummy[80];
FILE *fopen(),*fp1,*fp2;
/*-----------------------------------------------------------------*/
/* INITIALIZE APT COMMANDS */
/*-----------------------------------------------------------------*/
static char circle[] = {"SURF"};
static char coolant[] = {"COOL"};
static char spindle[] = {"SPIN"};
static char feedrate[] = {"FEDR"};
static char fini[] = {"FINI"};
static char from[] = {"FROM"};
static char gto[] = {"GOTO"};
static char intol[] = {"INTO"};
static char outtol[] = {"OUTT"};
static char rapid[] = {"RAPI"};
static char stop[] = {"STOP"};
static char toolno[] = {"LOAD"};
static char units[] = {"UNIT"};
/*-----------------------------------------------------------------*/
/* INITIALIZE CONTROL FLAGS */
/*-----------------------------------------------------------------*/
intol_fg=outtol_fg=spind_fg=from_fg=unit_fg = 0;
cir_fg = fedrate_fg = 0;
direct = 4;
/*=================================================================*/
/* DISPLAY THE INFORMATION ABOUT THE PROGRAM */
/*=================================================================*/
printf(" PROGRAM POSTPRO ***\n");
printf(" CONVERT AN APT-IV FILE TO G-CODE FROMAT\n");
printf("\nINPUT APT IV FILE NAME = ");
scanf("%s",aptfn);
fp1 = fopen(aptfn,"r");
if (fp1 == NULL)
{
printf("ERROR IN OPENING APT-IV FILE\n");
exit(1);
}
printf("\n OUTPUT G-CODE FILE NAME = ");
scanf("%s",gcodefn);
fp2 = fopen(gcodefn,"w");
/*=================================================================*/
/* READ PARTNO AND PARTNAME */
/*=================================================================*/
fscanf(fp1,"%6s %s",previous_cmd,pname);
i = compstr(previous_cmd,"PARTNO");
if (i==4)
{
fprintf(fp2,"O111;\n");
}
/*=================================================================*/
/* READ IN THE FIRST COMMAND */
/*=================================================================*/
fscanf(fp1,"\n%4s",cmd);
/*=================================================================*/
/* CHECK IF THE COMMAND "CMD" IS "FINI" THROUGH A 'DO-WHILE' LOOP */
/*=================================================================*/
j = 0;
do
{
/*==============================================================*/
/* CHECK IF THE COMMAND "CMD" IS "GOTO" */
/* AND READ THE FULL DATA LINE */
/*==============================================================*/
j = compstr(cmd,gto);
if (j == 4)
{
fscanf(fp1,"%1s%f,%f,%f",&c,&x,&y,&z);
/*===========================================================*/
/* IF THE COMMAND IS "GOTO", CHECK THE PREVIOUS COMMAND */
/*===========================================================*/
i = compstr(previous_cmd,"RAPI");
/*===========================================================*/
/* IF PREVIOUS COMMAND != RAPI */
/*===========================================================*/
if (i != 4)
{
/*===========================================================*/
/* IF PREVIOUS COMMAND = CIRCLE, */
/* CHECK IF THE POINT IS ON THE CIRCLE */
/*===========================================================*/
if(cir_fg == 1)
{
if(intol_fg==0) in_tol =0.2;
if(outtol_fg==0) out_tol = 0.2;
xtest = x_cir_ctr - x;
ytest = y_cir_ctr - y;
ztest = z_cir_ctr - z;
rad1 = sqrt(xtest*xtest + ytest*ytest + ztest*ztest);
radhigh = fabs(cir_rad) + in_tol + out_tol;
radlow = fabs(cir_rad) - in_tol - out_tol;
/*========================================================*/
/* IF THE POINT IS ON THE CIRCLE, */
/* CHECK IF THE CIRCLE IS CW OR CCW */
/*========================================================*/
if((rad1 >= radlow) && (rad1 <= radhigh) &&
((fabs(100.0*z)) == (fabs(100.0*z_prev))) )
{
/*=====================================================*/
/* AVIOD DIVIDING BY ZERO OR HAVING ONLY ONE POINT */
/*=====================================================*/
if(direct == 4 || (x == x_cir_ctr) ||
(xprev==x_cir_ctr))
{
if(direct == 4 ) direct = 3 ;
xprev = x;
yprev = y;
zprev = z;
}
/*==================================================*/
/* CALCULATE THETA1, THETA2 AND */
/* CHECK IF THE CIRCLE IS CW OR CCW */
/*==================================================*/
else
{
theta1 = atan((y-y_cir_ctr)/(x-x_cir_ctr));
theta2 = atan((yprev-y_cir_ctr)/(xprev-x_cir_ctr));
yprev = y;
xprev = x;
zprev = z;
if(theta1>theta2 && direct == 3 ) direct = 1;
if(theta1<theta2 && direct == 3 ) direct = 0;
if(theta1 == theta2 && direct == 3) direct = 3;
}
}
else
/*=====================================================*/
/* OTHERWISE THE POINT IS NOT ON THE CIRCLE, */
/* THUS THE 'CIRC'IS COMPLETE */
/*=====================================================*/
{
cir_fg = 0;
if(direct == 0)
/*==================================================*/
/* WRITE THE CW CIRCLE TO THE GCODEFN */
/*==================================================*/
{
sx = x_cir_start - x_cir_ctr;
sy = y_cir_start - y_cir_ctr;
px = xprev - x_cir_ctr ;
py = yprev - y_cir_ctr ;
/*===============================================*/
/* CROSS PRODUCT OF START AND END VECTOR */
/* TO DETERMINE IF 0 < ARC < 180 */
/*===============================================*/
xprod = (py*sx - px*sy);
if(xprod > 0 ) cir_rad = - cir_rad;
fprintf(fp2,"G02 X%8.3f Y%8.3f Z%8.3f R%8.3f;\n",
xprev,yprev,zprev,cir_rad);
fprintf(fp2,"G01 X%8.3f Y%8.3f Z%8.3f;\n",x,y,z);
x_prev = x;
y_prev = y;
z_prev = z;
direct=4;
}
/*==================================================*/
/* WRITE THE CCW CIRCLE TO GCODEFN */
/*==================================================*/
else
{
sx = x_cir_start - x_cir_ctr ;
sy = y_cir_start - y_cir_ctr ;
px = x - x_cir_ctr ;
py = y - y_cir_ctr ;
xprod = py*sx - px*sy ;
if(xprod < 0 ) cir_rad = - cir_rad;
fprintf(fp2,"G03 X%8.3f Y%8.3f Z%8.3f R%8.3f;\n",
xprev,yprev,zprev,cir_rad);
fprintf(fp2,"G01 X%8.3f Y%8.3f Z%8.3f;\n",x,y,z);
x_prev = x;
y_prev = y;
z_prev = z;
direct = 4;
}
}
}
else
/*========================================================*/
/* IF PREVIOUS COMMAND IS NOT A 'CIRCLE' */
/* WRITE G01 TO GCODEFN FILE */
/*========================================================*/
{
fprintf(fp2,"G01 X%8.3f Y%8.3f Z%8.3f;\n",x,y,z);
x_prev = x;
y_prev = y;
z_prev = z;
}
}
else
/*===========================================================*/
/* IF PREVIOUS COMMAND IS A 'RAPID' */
/* WRITE G00 TO GCODEFN FILE */
/*===========================================================*/
{
fprintf(fp2,"G00 X%8.3f Y%8.3f Z%8.3f;\n",x,y,z);
x_prev = x;
y_prev = y;
z_prev = z;
}
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'RAPID' */
/*==============================================================*/
j = 0;
j = compstr(cmd,rapid);
if ( j == 4)
{
fscanf(fp1,"%s",dummy);
strcpy(previous_cmd,"RAPI");
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'FEEDRATE' */
/*==============================================================*/
j = 0;
j = compstr(cmd,feedrate);
if ( j == 4)
{
fedrate_fg = 1;
fscanf(fp1,"%3s%f",dummy,&feed_rate);
fprintf(fp2,"F%8.3f;\n",feed_rate);
strcpy(previous_cmd,"FEDR");
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'SPINDLE SPEED' */
/*==============================================================*/
j = 0;
j = compstr(cmd,spindle);
if ( j == 4)
{
spind_fg = 1;
fscanf(fp1,"%3s%f,%s",dummy,&spind_rpm,spind_direct);
i = compstr(spind_direct,"CLW");
if ( i == 4)
{
fprintf(fp2,"M03 S%8.3f;\n",spind_rpm);
}
else
{
if ( (compstr(spind_direct,"OFF")) != 4)
{
fprintf(fp2,"M04 S%8.3f;\n",spind_rpm);
}
}
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'CIRCLE' */
/*==============================================================*/
j = 0;
j = compstr(cmd,circle);
if ( j == 4)
{
if (cir_fg == 1)
{
cir_fg = 0;
if (direct == 1)
{
sx = x_cir_start - x_cir_ctr ;
sy = y_cir_start - y_cir_ctr ;
px = x - x_cir_ctr ;
py = y - y_cir_ctr ;
xprod = py*sx - px*sy ;
if(xprod < 0 ) cir_rad = - cir_rad;
fprintf(fp2,"G03 X%8.3f Y%8.3f Z%8.3f R%8.3f;\n",
xprev,yprev,zprev,cir_rad);
x_prev = x;
y_prev = y;
z_prev = z;
direct =4;
}
else
{
sx = x_cir_start - x_cir_ctr ;
sy = y_cir_start - y_cir_ctr ;
px = x - x_cir_ctr ;
py = y - y_cir_ctr ;
xprod = py*sx - px*sy ;
if(xprod > 0 ) cir_rad = - cir_rad;
fprintf(fp2,"G02 X%8.3f Y%8.3f Z%8.3f R%8.3f;\n",
xprev,yprev,zprev,cir_rad);
x_prev = x;
y_prev = y;
z_prev = z;
direct =4;
}
}
cir_fg = 1;
fscanf(fp1,"%4s%f,%f,%f,%f,%f,%f,%f",dummy,&x,&y,&z,
&xdumc,&ydumc,&zdumc,&cir_rad);
x_cir_ctr = x;
y_cir_ctr = y;
z_cir_ctr = z;
x_cir_start = x_prev ;
y_cir_start = y_prev ;
if (x_cir_start == x_cir_ctr)
theta_start = 11.0/7.0 ;
else
theta_start = atan((y_cir_start-y_cir_ctr)/
(x_cir_start-x_cir_ctr));
if ( (theta_start < 0.0) && (y_cir_start < y_cir_ctr) )
theta_start = theta_start ;
if ( (theta_start < 0.0) && (y_cir_start > y_cir_ctr) )
theta_start = theta_start + (22.0/7.0) ;
if ( (theta_start > 0.0) && (y_cir_start < y_cir_ctr) )
theta_start = theta_start + (22.0/7.0) ;
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'STOP' */
/*==============================================================*/
j = 0;
j = compstr(cmd,stop);
if ( j == 4)
{
if(spind_fg == 1) spind_fg = 0;
fprintf(fp2,"M05;\n");
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'INTOL' */
/*==============================================================*/
j = 0;
j = compstr(cmd,intol);
if ( j == 4)
{
intol_fg = 1;
fscanf(fp1,"%2s%f",dummy,&in_tol);
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'OUTTOL' */
/*==============================================================*/
j = 0;
j = compstr(cmd,outtol);
if ( j == 4)
{
outtol_fg = 1;
fscanf(fp1,"%3s%f",dummy,&out_tol);
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'UNITS' */
/*==============================================================*/
j = 0;
j = compstr(cmd,units);
if ( j == 4)
{
unit_fg = 1;
fscanf(fp1,"%2s%s",dummy,unit_type);
i = compstr(unit_type,"MM");
if (i == 4)
fprintf(fp2,"G21;\n");
else
fprintf(fp2,"G20;\n");
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'COOLANT' */
/*==============================================================*/
j = 0;
j = compstr(cmd,coolant);
if ( j == 4)
fscanf(fp1,"%3s%3s",dummy,cool_state);
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'FROM' */
/*==============================================================*/
j = 0;
j = compstr(cmd,from);
if ( j == 4)
{
from_fg = 1;
fscanf(fp1,"%1s%f,%f,%f",dummy,&from_x,&from_y,&from_z);
fprintf(fp2,"G92 X%8.3f Y%8.3f Z%8.3f ;\n"
,from_x,from_y,from_z);
fprintf(fp2,"G90;\n");
}
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'TOOLNO' */
/*==============================================================*/
j = 0;
j = compstr(cmd,toolno);
if ( j == 4)
fscanf(fp1,"%3s%s",dummy,tool_no);
/*==============================================================*/
/* CHECK IF THE COMMAND 'CMD' IS 'FINI' */
/*==============================================================*/
j = 0;
j = compstr(cmd,fini);
if ( j == 4 ) break;
/*==============================================================*/
/* READ THE NEXT LINE OF THE APTFN FILE */
/*==============================================================*/
fscanf(fp1,"\n%4s",cmd);
j = compstr(cmd,fini);
}
/*=================================================================*/
/* END OF THE DO-WHILE LOOP WHEN THE COMMAND 'CMD' IS 'FINI' */
/*=================================================================*/
while ( j != 4) ;
fprintf(fp2,"M30;\n%%\n");
}
/**********************************************************************/
/* FUNCTION COMPSTR ( COMPARE STRING ) */
/* RETURN '4' IF TWO STRINGS 'S' AND 'T' ARE EQUAL */
/**********************************************************************/
compstr(s,t)
char s[] , t[];
{
int i ;
i = 0;
while (s[i] == t[i])
{
if ( s[i++] == '\0') return(4);
i = i+1;
}
return(i);
}
ACKNOWLEDGEMENTS
Thanks are due to previous MECH 460 and MECH 521 students for their input and
suggestion in revising this manual.