Sie sind auf Seite 1von 7

DR B R AMBEDKAR NATIONAL OF TECHNOLOGY JALANDHAR-144011, INDIA

DEPARTMENT OF INDUSTRIAL AND PRODUCTION ENGINEERING


IVTH INTERNATIONAL CONFERENCE ON PRODUCTION AND INDUSTRIAL ENGINEERING, CPIE-2016

MACHINING OF BEZIER CURVE BY

MACRO PROGRAMMING
Vratraj K Joshi1, Prof K P Desai2, Prof H K Raval3
1
Research Scholar, Department of Mechanical Engineering, SVNIT, Surat 395007
2-3
Professor, Department of Mechanical Engineering, SVNIT, Surat 395007

ABSTRACT
It is necessary to machine curvilinear tool paths considering aesthetic requirements of todays
manufacturing world. Generally, preparatory codes available with the machine controller but,
the limitation of machining curvilinear tool paths, as most of the controllers are supported
with machining of linear and circular tool path. Further, the machining of curvilinear tool
path using commercially available CAD-CAM software required the identification of current
cutter location points which are to be connected by linear interpolation. Each linear segment
to machine the curve is adding single block in the part program. This will increase length of
the part program and add to program memory size. Understanding of the CAD software is
also essential to machine the curve shape. To overcome this difficulty, MACRO
programming is attempted to machine curvilinear profile (Bezier Spline). It can be introduced
at any block with subroutine without affecting previous preparatory or miscellaneous codes.
The purpose of the present work is to machine Bezier spline expressed by mathematical
equation using MACRO programming. Surfaces quality for the machined tool path is
measured and reported.

NOMENCLATURE

CAD: Computer aided design


CAM: Computer aided manufacturing
CNC: Computer numerical control

1. INTRODUCTION
Like any other computer programming language, programming with MACRO can be
prepared while working with CNC Fanuc controller. It can be executed by preparatory codes
of CNC controller. It is a flexible programming that can utilize conditional and logical loops,
arithmetic variables and operators. A subprogram is required for parts with similar machining
operations. But, for parts with the similar design, a single MACRO part program is to be
developed that can considerably reduce part programming time. It can be further beneficiary
in product development. It is to be prepared frequently for changing workpiece variable such
as dimensions, holes, threads, slots etc. A single MACRO program can machine similar parts
and most suitable for a same part family because tool position coordinates are not needed to
be changed every time as and when the part is changed. It helps in reducing duplication of the
similar program. Some of the commands used in MACRO program are GO TO, IF
[condition] THEN [do something condition], EQ [equals], NE [not equals], GT [greater then],
LT [Less then], +, -, *, /, SIN, COS, TAN, ATAN, SQRT, ABS etc. Good amount of work
has been carried by various authors to develop algorithms for command generation or canned
cycle to reduce program length as well increase shape flexibility.

1
DR B R AMBEDKAR NATIONAL OF TECHNOLOGY JALANDHAR-144011, INDIA
DEPARTMENT OF INDUSTRIAL AND PRODUCTION ENGINEERING
IVTH INTERNATIONAL CONFERENCE ON PRODUCTION AND INDUSTRIAL ENGINEERING, CPIE-2016

2. BACKGROUND AND REVIEW


G. Albrecht and R.T. Farouki (1996) formulated Pythagorean Hodograph spline with very
good shape property and interpolated it with C2 continuity (i.e. tangential continuity). R.T.
Farouki (1996) implemented high level language to derive Tschrinhausens cubic. Wherein,
Explicit function is formulated with the compact part program. T. Sata et al (1981) defined
the numerically controlled tool path with Beziers curve. D.J. Walton and D.S. Meek (1996)
represented straight line segments and circular arcs by Non Uniform Rational B Spline.
Omirou S and Barouni A. (2005) developed algorithms with Implicit function for precise
interpolation. Omirou S. and Nearchoub A. (2009) proposed novel code with single block
part program considering epitrochoidal with mathematical description, formulation and
verification. A.T. Abbas and S.M. Megahed (2005) reduced length of part program by
proposing canned cycles provide a programming method for repetitive drilling operation
using the standard G code. Command can be generated for a cutter tool path to machine free
form space curve. R.T. Farouki (1999) proposed codes to machine free form tool path with
Pythagorean-hodograph interpolation instead of conventional linear/ circular approximation.
Pateloup V et al (2004) used B-spline tool path in comparison with straight lines and arcs to
reduce machining time. While programming of contour or free form curve modelling using
linear interpolation, single block of the part programming is dedicated to each linear
interpolation. Thereby the length of program increases and also occupies more memory
space. Further, at every linear interpolation junction point, the cutting speed is affected,
which may results into poor surface finish.

3. OUTCOME OF LITERATURE REVIEW


From the literature, it is noted that geometrical data of the cutter path is stored in a CAD
model and transformed to CAM to machine the curve. Commands for CNC machining can be
developed that convert motion trajectory from the desired path. In the present work, MACRO
programming with Bezier spline is attempted. A circular tool path fitted with Bezier spline is
machined. MACRO programming for the circular geometry is compared with the
conventional part programming approach considering linear interpolation.

4. MODELLING/EXPERIMENTATION
The curve geometry can be represented mathematically by 2nd or higher order; for every point
P on the Bezier spline.
P(u ) Ap 0 (u ) Bp1 (u ) Cp 2 (u ) Dp 3 (u ) (1)
where,
A 1 3t 3t 2 t 3
B 3t 6t 2 3t 3
C 3t 2 3t 3
D t3

Rewriting equation (1) for x co ordinates and y co ordinates for 0 t 1,


P( x ) 1 3t 3t 2 t 3 p 0 ( x ) 3t 6t 2 3t 3 p1( x ) 3t 2 3t 3 p 2 ( x ) t 3 p 3 ( x ) (2)
P( x ) 1 t p 0 ( x ) 3t 1 t p1( x ) 31 t t p 2 ( x ) t p 3 ( x )
3 2 2 3

P( y ) 1 3t 3t 2 t 3 p 0 ( y ) 3t 6t 2 3t 3 p1( y ) 3t 2 3t 3 p 2 ( x ) t 3 p3( y ) (3)

P( y ) 1 t p 0 ( y ) 3t 1 t p1( y ) 31 t t 2p 2 ( y ) t 3 p3( y )
3 2

2
DR B R AMBEDKAR NATIONAL OF TECHNOLOGY JALANDHAR-144011, INDIA
DEPARTMENT OF INDUSTRIAL AND PRODUCTION ENGINEERING
IVTH INTERNATIONAL CONFERENCE ON PRODUCTION AND INDUSTRIAL ENGINEERING, CPIE-2016

Circular arc in first quadrant can be represented as a cubic curve by adjusting starting point
P0, end point P3 and control points P1 and P2. In first quadrant, circular arc intersects
horizontal axis (i.e. x axis) at point P0 (1, 0) and vertical axis (i.e. y axis) at P3 (0, 1) as shown
in figure 1. Considering single arc of circle as a Bezier spline, start point and end point will
be P0 [1, 0] and P3 [0, 1] and control points will be P1 [1, K] and P2 [K, 1]. The position of the
control points P1 and P2 can be determined by finding the value of K. Here, the values of
P0x and P3x are 1 and 0 respectively. As, t is considered as a knot vector of Bezier spline,
value of t is 0 (zero) at start point P0 , 1 (one) at end point P3 and 0.5 at the middle point of
the curve tangent.
The value of knot vector can be taken in the range of 0 to 1.0 (i.e.one). In the present study
for the circular curve, the value of knot vector t is taken 0.5 to solve equation (2) at the
midpoint of the spline,
P (x) = (1-0.5) 3 P0 X+ 3(1-0.5) 2 (0.5) P1X + 3(1-0.5) (0.5)2 P2 X + (0.5)3 P3X (4)
For the curve segment 00 to 900, the midpoint of curve angle is 450. Hence, cosine distance is
0.707.
So, substituting P(x) = 0.707 in equation (4)
0.707 = (1-0.5) 3 (0) + 3(1-0.5) 2 (0.5) (1) + 3(1-0.5) (0.5)2 (K) + (0.5)3 (1) (5)
Resolving the equation (5),
K=0.552
Figure 1 Circular arc as a Bezier Spline

Circular arc for first quadrant is shown in Figure 1. It can be represented as a cubic Bezier
spline curve by adjusting points P0 (1, 0), P1 (0.552, 1), P2 (1, 0.5520 and P3 (0, 1)
respectively. After determining the value of X and Y co ordinates, with the help of equation
(2) and (3) other cutter location points on the circure tool path are determined.
The machining of circular cutter path is carried out using MACRO programming and
considering curve as a Bezier spline. The complete circle is derived in to four quadrant
having center of the circle at an origin of the Cartesian axis. The co ordinate of various points
(viz. start point P0, first control point P1, second control Point P2, and end point P3) for each
quadrant are summarize in table 1. The start point P0, first control point P1, second control
Point P2, and end point P3, value of X and Y co ordinates are positive in first quadrant, value
of X co ordinate is negative and Y co ordinate is positive in second quadrant, value of X and
Y co ordinates are negative in third quadrant. In fourth quadrant value of X co ordinate is
positive and Y co ordinate is negative. It is noted that end point of spline in any quadrant
becomes start point of immediate next quadrant in anti clockwise direction. By stitching, the
end point of one arc of the 1st quadrant with the start point of the second arc in 2nd quadrant,
end point of second arc of the 2nd quadrant with the start point of the third arc of the 3rd
quadrant, end point of third arc of the 3rd quadrant with the start point of the fourth arc of the

3
DR B R AMBEDKAR NATIONAL OF TECHNOLOGY JALANDHAR-144011, INDIA
DEPARTMENT OF INDUSTRIAL AND PRODUCTION ENGINEERING
IVTH INTERNATIONAL CONFERENCE ON PRODUCTION AND INDUSTRIAL ENGINEERING, CPIE-2016

4rd quadrant and end point of fourth arc of the 4th quadrant with the start point of the first arc
the 1st quadrant will form circular geometry using Bezier Spline.
Table 1 Sign Convention for circle in each quadrant
Quadrant

i ii iii iv
Start Point P0 (1,0) (0,1) (-1,0) (0, -1)
First Control Point P1 (1,0.552) (-0.552, 1) (-1, -0.552) (0.552, -1)
Second Control Point P2 (0.552, 1) (-1, 0.552) (-0.552, -1) (1, -0.552)
End Point P3 (0,1) (-1,0) (0,-1) (1,0)
Figure 2 shows the flow chart describing the steps of the various calculated x, y co ordinates
at various point on circular geometry using Bezier spline function. Circle is obtained by
connecting Bezier spline in each quadrant.
Figure 2 Flow chart of a Circle represented by Bezier spline function

Start

Get value of circle start


point P0, end point P3 and
Control points P1, P2

t=0
t=t+0.01

Y
t>1

P(x) = (1-t)3 P0X + 3t(1-t)2P1X + 3t2(1-t)P2X + t3P3X


P(y) = (1-t)3P0Y + 3t(1-t)2P1Y + 3t2(1-t)P2Y + t3P3Y
=P(y)

End

Start point P0, end point P1, control points P2 and P3 are to be selected as per quadrant of the
circular arc. Total 100 cutter location points are determined to interpolate with Bezier spline
function in each quadrant. Hence, the value of knot variablet starts from zero and it is
increased in the step size of 0.01 up to maximum value of t is equal to 1.0 (i.e. one). The
initial value of knot vectort, X and Y co ordinates of P0, P1, P2 and P3 are stored in
MACRO as per Table 2. Separate MACRO addresses are assigned to feed (F), spindle speed
(S), depth of cut (z) and knot vector (t). The variable can be changed as per geometrical
requirement. This makes program flexible. The Circle is fitted with the linear interpolation
(G01) by Conventional programming method with the fixed angular distance between two
successive co ordinates. As discussed earlier, total 100 cutter location points in each quadrant
are determined to interpolate circle with Bezier spline function by MACRO programming
method.

4
DR B R AMBEDKAR NATIONAL OF TECHNOLOGY JALANDHAR-144011, INDIA
DEPARTMENT OF INDUSTRIAL AND PRODUCTION ENGINEERING
IVTH INTERNATIONAL CONFERENCE ON PRODUCTION AND INDUSTRIAL ENGINEERING, CPIE-2016

Table 2 Assigning MACRO address to program variables


MACRO
Variable Description Initial Value
Address

P0x X coordinate of start point P0


#101 P1x X coordinate of control point P1 1
P2y Y coordinate of control point P2
P3y Y coordinate of end point P3
P1y Y coordinate of control point P1
#102 0.552
P2x X coordinate of control point P2
P0y Y coordinate of end point P0
#103 0
P3x X coordinate of start point P3
#104 F Feed 100
#105 S Spindle speed 1500
#106 t Knot vector 0
#107 z Depth of cut 0.2

The same numbers of cutter location points are required to interpolate the circle with
conventional method. For that, circle is plotted in AutoCAD and 100 cutter location points
are measured at fixed angular interval in each quadrant.
5. RESULT AND DISCUSSION

For MACRO programming, Circle is interpolated with Bezier spline. Knot vector starts from
initial value 0 and ends at 1 with the increment of 0.01 in each quadrant. It means total
calculated cutter location points are determined by dividing the subtraction of maximum
value of knot vector and minimum value of knot vector with the step size [i.e. (1-0) / 0.01
=100] in each quadrant. Drawing a circle in AutoCAD with measuring 100 cutter location
points in each quadrant take more time. In the present case, time for drawing circles with
dimensions 100 cutter location points for each quadrant in AutoCAD is 4925 seconds. Table
3 shows a comparison between MACRO and Conventional programming for machining of
the circular geometry.
Table 3 Comparison of conventional programming with MACRO programming (Bezier
Spline)
Time (Seconds)
Circular Length Size
tool path (Words) (KB) Program Writing Program
Total
Drawing Feeding execution
Conventional
2709 17 4925 1140 117 6182
programming
Bezier spline
268 11 0 332 219 551
MACRO

Time for feeding these co ordinates is 1140 seconds. In case of MACRO programming, cutter
tool path is equation driven. No such drawing is needed. Hence, program feeding time (332
seconds) is very less. It is notable that machine feed is 100 mm/min and program execution
time to cut a circle by conventional programming is 117 seconds. But, in case of MACRO
programming, circle fits as a Bezier spline. In this case, the processor has to calculated X and
Y co ordinate for every cutter location points. So, program execution time is 219 seconds,
more than double of conventional programming. Considering the total time, program writing
time (including drawing and feeding) with program execution time for the Conventional
method to cut the circle is quite high (6182 seconds) compared to MACRO programming
method (551 seconds). The additional advantage of MACRO programming is that program
size is 17 KB and length 2709 words for conventional programming. Which is more than
MACRO programming program size is 11 KB and length is 268 words.

5
DR B R AMBEDKAR NATIONAL OF TECHNOLOGY JALANDHAR-144011, INDIA
DEPARTMENT OF INDUSTRIAL AND PRODUCTION ENGINEERING
IVTH INTERNATIONAL CONFERENCE ON PRODUCTION AND INDUSTRIAL ENGINEERING, CPIE-2016

Figure 3 Surface roughness for various programming method

2.5

2
Surface Roughness Ra

1.5
Conventional

1 Bezier Spline

0.5

0
0 30 60 90 120 150 180 210 240 270 300 330 360
Development of Angle

The circular tool path is fitted with Bezier spline to cut by MACRO programming method.
The similar circular tool path is linearly interpolated cutter location points cut by
Conventional programming method. The surface quality is examined, for both the methods
with the help of SURFTEST (SJ-210 Mitutoyo). The work piece is marked clockwise at 300
for the measurement of surface quality at 12 positions (3600/120) of the test piece. As stated
in Figure 3, surface roughness is less in the case of the circle is fitted with Bezier spline and
cut with MACRO compared to Conventional programming. This is because, controller takes
more time (219 seconds) to cut the circular profile interpolated with Bezier spline function
compared to time taken (117 seconds) to cut with Conventional method as the controller has
to compute the co ordinate of each point based on the term used in MACRO programming.
The tool stops for a while at the previous point co ordinates till the next point is calculated. It
minimizes tool over drive and improve surface quality while machining circular profile with
Bezier spline function using MACRO programming method.
6. CONCLUSIONS

Following conclusions can be narrated from attempted work:


1. Surface roughness of circular tool path cut by conventional programming method is
found to be more compared to circular tool path cut by MACRO programming
method.
2. With the help of curve fitting with Bezier spline, shape flexibility can also be
achieved by moving control point. Therefore without CAD software also geometry
can be generated using CNC machine.
3. Dimension flexibility can be attained in the case of MACRO programming. There is
no need to write program every time in case of a change in dimension for the same
geometry, only variables are to be changed. It leads to the user friendliness of
programming. Semi skill operator can also handle MACRO programming if trained.
4. This work can be extended to develop dedicated G code for the geometry of the same
group, for the shape of which there is no preparatory code readily available. The
circular geometry in the present case can be extended to ellipse. There is no specific
code available for machining ellipse.

6
DR B R AMBEDKAR NATIONAL OF TECHNOLOGY JALANDHAR-144011, INDIA
DEPARTMENT OF INDUSTRIAL AND PRODUCTION ENGINEERING
IVTH INTERNATIONAL CONFERENCE ON PRODUCTION AND INDUSTRIAL ENGINEERING, CPIE-2016

REFERENCES
G. Albrecht, R.T. Farouki (1996) Construction of C2 Pythagorean hodograph interpolating
splines by the homotopy method Advances in Computational Mathematics, 5, 417-442
Farouki R.T. (1996) The elastic bending energy of Pythagorean hodograph curves
Computer aided Geometric Design, 13, 227-241
T. Sata, F. Kimura, N. Okada, M. Hosaka (1981) A new method of CNC interpolation for
machining the sculptured surface Annals of the CIRP, 30, 369-372
D.J. Walton, D.S. Meek (1996) A Pythagorean Hodograph quintic spiral Computer Aided
Design, 28, 943-950
Omirou S., Barouni A. (2005) Integration of new programming capabilities into a PC-based
milling machine controller Robotics and Computer Integrate Manufacturing, 21/6, 518-527.
Omirou S., Nearchoub A. (2009) An epitrochoidal pocket - A new canned cycle for CNC
milling machines Robotics and Computer-Integrated Manufacturing, 25 /1, 73-80
Abbas A.T., S.M. Megahed (2005) A general algorithm for drilling holes lying in a matrix
Computer Integrated manufacturing, 21, 235-239
Farouki RT, Manjunathaiah J, Yuan G. (1999) G codes for the specification of Pythagorean
hodograph tool paths and associated federate functions on open architecture CNC machines
International Journal of Machine Tools Manufacturing, 39, 123-142
Pateloup V, Duc E, Ray P, (2004) Corner optimization for pocket machining International
Journal of Machine Tool Manufacturing, 44/12, 1343-53

Das könnte Ihnen auch gefallen