Abstract:
A free-form curve interpolation method and device is provided for smoothly interconnecting curves using a non-uniform rational B-spline (NURBS) curve representation. This ability to interconnect free-form curves is important when machine parts of small dimensions or complex configuration. This is accomplished by a preprocessing calculation unit reads NC programs including an interpolation command of a NURBS curve expressed by a function using a parameter t as a variable, and calculates a distance ΔL to move during an interpolation period T. A parameter change calculation unit calculates a change Δt in the parameter t brought on when moving by the distance ΔL, on the basis of a current position specified by a current value t i  of the parameter t. A movement amount calculation unit calculates a position when the value of parameter t is t i  +Δt, by a defining formula of the NURBS curve. Subsequently, the movement calculation unit calculates a movement amount of each axis for amoving to the calculated position, and outputs an interpolation pulse to each axis.

Description:
TECHNICAL FIELD 
     The present invention relates to a free-form curve interpolation method for a numerical control unit, and in particular, to a free-form curve interpolation method of a curve represented by a NURBS (Non-Uniform Rational B-Spline). 
     DESCRIPTION OF THE RELATED ART 
     In order to machine a workpiece with machine tools, NC programs executed by to a computer numerical control (CNC) unit are in many instances created by automatic programming function based on a form drawn by a CAD (Computer Aided Design), system etc. In this case, one who designs a profile of workpiece can freely draw various curves using a various functions of a CAD system. 
     However, it is difficult to smoothly connect free-form curves expressing complicated profiles with one another. To deal with this, a free-form curve is divided into relatively simple intervals called segments, in order to represent the curve. There is a Base Spline curve as one of the functions for defining the free-form curve, and it is commonly called a B-Spline curve. The B-Spline curve can be defined by a plurality of control vectors. Moreover, a parameter corresponding to a junction between segments of B-Spline curve is called a knot. The value of the knot gradually increases from the start point toward the end point of the B-Spline curve. 
     Then, the B-Spline curve which is nonuniform in the increase rate of knot is rationalized, and a curve thus obtained is called a NURBS (Non-Uniform Rational B-Spline) curve. 
     In the CAD system for a design of industrial products, etc., it is becoming popular to represent profiles of a curve and a curved surface with NURBS. This NURBS curve is adopted, as a form representing a free-form curve, in a standard of CAD data exchange, i.e., an IGES (Initial Graphics Data Exchange Specification). 
     On the other hand, in interpolating the free-form curve using a conventional CNC, it is necessary to do so by combining small blocks such as small straight lines, small circular arcs, etc. Therefore, in general, CAD data represented by the NURBS curve is approximated to small straight lines, small circular arcs of the free-form curve designed by the CAD system in the stage before the CNC unit prepares command formats. 
     However, as movement command blocks for the purpose of improving machining accuracy of industrial products are made smaller, various problems have arisen. For example, there are problems such as delay of command program transmission speed between a host computer and a CNC unit due to influence caused by the large number and size of command blocks, and a delay of command program analysis processing speed of the CNC unit, etc. As described above, the NURBS curve drawn by the CAD system has to be decomposed into smaller blocks in order to be processed by the numerical control unit for interpolation of NURBS curve by the numerical control unit. For this reason, complicate processing is required , thereby causing the problem of long execution time. 
     SUMMARY OF THE INVENTION 
     An object of the present invention is to provide a free-form curve interpolation method and an apparatus thereof for a numerical control unit, which is capable of performing an interpolation of a NURBS curve by commanding data for specifying the NURBS curve directly to the numerical control unit. 
     A free-form curve interpolation method according to the present invention repeats a series of following processings: 
     first, recognizing a NURBS curve interpolation command included in NC programs; 
     calculating a distance to move during an interpolation period used as unit period, on the basis of a feed rate command in the recognized interpolation command; 
     calculating a change in a parameter brought on when moving by the calculated distance from a current position specified by a current value of the parameter; 
     calculating a position to be specified by the parameter as the sum of the calculated change of the parameter and the current parameter, based on the defining formula of the aforesaid NURBS curve; 
     calculating a movement amount of each axis for moving to the calculated position; and 
     outputting an interpolation pulse to each axis. 
     A free-form curve interpolation apparatus according to the present invention comprises: 
     preprocessing calculation means for reading NC programs including an interpolation command of a NURBS curve expressed by a function using a specific parameter as a variable, and calculating movement amount per unit time on the basis of a feed rate command in the interpolation command of the NURBS curve, thus outputting a movement command; 
     parameter change calculation means for calculating a change in the parameter brought on when moving by the movement amount; and 
     movement calculation means for obtaining a coordinate value to be interpolated next by substituting a value, as the sum of the change rate and a current value of the parameter, for the function of the NURBS curve, in order to calculate movement amount of each axis. 
     In the present invention, the CNC is set so that it calculates a function of the NURBS curve on the basis of data given to the CNC to obtain an interpolation path. Therefore, a programmer can give a command for the NURBS curve drawn by the CAD or the like directly to the CNC, so that the interpolation of the NURBS curve can be executed in the CNC. As a result, NC programs can be simplified, so that program transmission and program analysis processing can be performed at a high speed, and machining accuracy can be improved as well. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram schematically showing a construction of the present invention; 
     FIG. 2 is a flowchart showing a process for designing profile having a NURBS curve by a CAD system and for executing the profile machining with a machine tool; 
     FIG. 3 is a diagram showing an example of a command format of the NURBS curve; 
     FIG. 4 is a diagram showing a movement amount in an interpolation period; 
     FIG. 5 is a diagram showing an example of NC program for executing the interpolation of NURBS curve; 
     FIG. 6 is a diagram showing the relationship between control points and the NURBS curve; and 
     FIG. 7 is a diagram showing an interpolation path drawn according to the NC programs shown in FIG. 5. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 1 is a block diagram schematically showing a construction of the present invention. There is prepared an NC program 1 including an interpolation command of a NURBS (Non-Uniform Rational B-Spline) curve. The profile of the NURBS curve is specified by data such as weight, and expressed by a function using a parameter &#34;t&#34; as a variable. Thus, if the value of parameter &#34;t&#34; at any time is determined, the coordinate value at that time is specified by a defining formula of the NURBS curve. 
     A preprocessing calculation unit 2 reads the NC program 1. Recognizing an interpolation command of the NURBS curve, the preprocessing calculation unit 2 calculates a distance ΔL to move during an interpolation period used as a unit period, on the basis of a feed rate command in the interpolation command. The distance ΔL, together with other data for creating a function of the NURBS curve, is inputted to an interpolation unit 3. 
     The interpolation unit 3 comprises parameter change calculation unit 3a and movement calculation unit 3b. The parameter change calculation unit 3a calculates a change Δt in the parameter &#34;t&#34; brought on when moving by the distance ΔL from the current position specified by the current value &#34;t i  &#34; of the parameter &#34;t&#34;. 
     The movement calculation unit 3b calculates a position at which the value of parameter &#34;t&#34; becomes &#34;t i  +Δt&#34; by the defining formula of the NURBS curve. 
     Subsequently, the movement calculation unit 3b calculates a movement amount of each axis for moving to the position, and outputs interpolation pulses ΔX, ΔY and ΔZ corresponding to respective axes. Then, the value of &#34;t i  +Δt&#34; is transmitted to the parameter change calculation unit 3a as a value of &#34;t i  +1&#34; 
     Interpolation pulses ΔX, ΔY and ΔZ are individually input to each of corresponding axis control circuits 4a, 4b and 4c. The axis control circuits 4a, 4b and 4c respectively outputs a movement command to each of corresponding servo amplifiers 5a, 5b and 5c, whereupon servo amplifiers 5a, 5b and 5c respectively control rotation of each of the servo motors 6a, 6b and 6c according to the movement command. 
     In the manner as described above, data for specifying the NURBS curve drawn by the CAD system or the like is transmitted directly to the CNC, so that a free-form curve interpolation of the NURBS curve can be executed. 
     Next, detailed descriptions on the NURBS curve will be given. In order to indicate that a symbol shown in a numerical equation is a vector, the symbol is surrounded with angle brackets &#34;&lt; &gt;&#34; 
     The NURBS curve of rank &#34;j&#34; (j-1 degrees) is defined by the following equation (1): ##EQU1## 
     As seen from the above explanation, the NURBS curve is a function using the parameter &#34;t&#34; as a variable, and is represented by a vector &lt;P(t)&gt;. Also, a basic function N is expressed by the following equations. For example, 1 rank basic function N i ,1 (t) is expressed as follows: ##EQU2## 
     Also, k rank basic function N i ,k (t) is expressed as follows: ##EQU3## 
     In the above equations (1) to (3), &lt;P i  &gt;is a control point vector (0≦i≦n), and represents a control point inputted according to NC programs. Wi is weight (0≦i≦n); on the other hand, X i  is knot (X i  ≦X i+1 ). A sequence  X 0 , X 1 , X 2 , . . . X m  ! is a knot vector. In this case, the following relational equation is established, that is, &#34;control point (n+1)+rank(j)=number of knot(m +1) &#34;. 
     FIG. 2 shows a process for designing a profile of the NURBS curve by the CAD system and for executing profile machining with the machine tool. More specifically, first, a design of molds, etc., are made by the CAD function (Step S1). In this case, a free-form curve is represented on the basis of the NURBS curve. Next, NC part programs are prepared by the function of CAM (Step S2). In this case, the CNC converts the NURBS curve into a predetermined NC program format, and prepares a NURBS curve interpolation command. Subsequently, the CNC executes NC programs including the NURBS curve interpolation command so that machine tool can machine workpieces such as molds, etc.(Step S3). 
     FIG. 3 shows an example of a NURBS curve command format. An NC program 20 is prepared on the basis of the format as shown in FIG. 3, whereby the NURBS curve interpolation is commanded to the CNC. 
     In this example, &#34;G06.2&#34; denotes a NURBS curve interpolation start command, &#34;P&#34; denotes rank, each of &#34;X&#34;, &#34;Y&#34; and &#34;Z&#34; denotes a control point, &#34;K&#34; denotes knot, &#34;R&#34; denotes weight, &#34;F&#34; denotes velocity and &#34;G01&#34; denotes a linear interpolation command. &#34;j&#34;, &#34;X i  &#34; and &#34;W i  &#34; in the above equations (1), (2) and (3) are given as values of these &#34;P&#34;, &#34;K&#34; and &#34;R&#34;, respectively. In order to specify the NURBS curve, there is a need of knot which in number is equivalent to the sum of the number of ranks and the number of control points. For this reason, in this example, when commanding a control point, knot is simultaneously commanded, and further, knot equivalent to the number of rank is commanded in another block. If weight is not commanded, the value of weight is regarded as &#34;1&#34;. The NURBS curve interpolation command is canceled by other interpolation start command such as linear interpolation start command (G01), etc. 
     When the NC program as described above is input to the CNC, the NURBS interpolation start command is recognized by the preprocessing calculation means included in the CNC. A distance ΔL to move during interpolation period is calculated on the basis of a feed rate &#34;F&#34;. Subsequently, a change Δt in the current parameter &#34;t&#34; for moving by the distance ΔL is obtained from the following equation (4) on the basis of the distance ΔL. ##EQU4## 
     In the above equation (4), a denominator |&lt;&#39;(t)&gt;|is an absolute value obtained by differentiating the vector &lt;P(t)&gt;by the parameter &#34;t&#34;. 
     A value of the vector P (t+Δt) obtained by substituting for the above equation (1) a sum of a parameter change Δt obtained from the above equation (4) and a value of current parameter &#34;t&#34; is the next interpolation point. 
     FIG. 4 is a diagram showing a movement amount during interpolation period. In FIG. 4, the current position P(t) on a commanded NURBS curve 10 is a point represented by a vector &lt;P(t)&gt;. Differentiating the vector &lt;P(t)&gt;by the parameter &#34;t&#34;, a vector &lt;P&#39;(t)&gt;is obtained. Thus, a point on the NURBS curve 10 separated from the vector &lt;P(t)&gt;by the distance ΔL is a point P (t+Δt) represented by the vector &lt;P(t)&gt;. 
     Then, the movement calculation means 3b (shown in FIG. 1) calculates a movement amount of each axis from the point &lt;P(t)&gt;to the point P (t+Δt), and outputs interpolation pulse to each axis, whereby interpolation can be executed on a path along the NURBS curve 10. 
     The following is the detailed description of the case where a fourth rank (3rd order) NURBS curve interpolation is executed. 
     FIG. 5 is a diagram showing an example of NC programs for executing the NURBS curve interpolation. In an NC program 21, a NURBS curve interpolation start command (G06.2) designates six control points. The coordinate of the first control point is (X0, Z0), the coordinate of the second control point is (X300, Z100.), the coordinate of the third control point is (X700, Z100.), the coordinate of the fourth control point is (X1300, Z-100.), the coordinate of the fifth control point is (X1700, Z-100.), and the coordinate of the sixth control point is (X2000, Z0). On the other hand, the knot is designated in the following named order, &#34;0&#34;, &#34;0&#34;, &#34;0&#34;, &#34;0&#34;, &#34;0.5&#34;, &#34;0.5&#34;, &#34;1.0&#34;, &#34;1.0&#34;, &#34;1.0&#34; and &#34;1.0&#34;. 
     Subsequently, the NURBS curve interpolation start command (G06.2) is given after linear interpolation command (G01, Y100.). At this time, six control points are designated. The coordinate of the seventh control point is (X2000, Z0), the coordinate of the eighth control point is (X1700, Z-100.), the coordinate of the ninth control point is (X1300, Z-100.), the coordinate of the tenth control point is (X700, Z100.), the coordinate of the eleventh control point is (X300, Z100.), and the coordinate of the twelfth control point is (X0, Z0). On the other hand, the knot is designated in the following named order, &#34;0&#34;, &#34;0&#34;, &#34; &#34;, &#34;0&#34;, &#34;0.5&#34;, &#34;0.5&#34;, &#34;1.0&#34;, &#34;1.0&#34;, &#34;1.0&#34; and &#34;1.0&#34;. 
     The NURBS curve interpolation start command is cancelled by linear interpolation command (G01, Y100). 
     In the example case shown in FIG. 5, &#34;j&#34; is 4, and &#34;n&#34; is 5; therefore, the denominator and fraction of the vector &lt;P(t)&gt;defining the NURBS curve are expressed as follows on the basis of the equation (1). 
      Fraction!: 
     
         N.sub.0.4 (t)&lt;P.sub.0 &gt;+N.sub.1.4 (t)&lt;P.sub.1 &gt;+N.sub.2.4 (t)&lt;P.sub.2 &gt;. . . N.sub.5.4 (t)&lt;P.sub.5 &gt; 
    
      Denominator!: 
     
         N.sub.0.4 (t)+N.sub.1.4 (t)+N.sub.2.4 (t) . . . N.sub.5.4 (t) 
    
     In this case, it is commonly known that the value of denominator becomes &#34;1&#34; because Wi is always &#34;1&#34;. 
     Therefore, the vector &lt;P(t)&gt;is expressed by the following equation (5). 
     
         &lt;P(t)&gt;=N.sub.0.4 (t)&lt;P.sub.0 &gt;+N.sub.1.4 (t)&lt;P.sub.1 &gt;+N.sub.2.4 (t)&lt;P.sub.2 &gt;. . . N.sub.5.4 (t)&lt;P.sub.5 &gt;                (5) 
    
     where, X 0  ≦t &lt;X 9 . 
     Also, in FIG. 5, 
     X 0  =0.0, X 1  =0.0, X 2  =0.0, X 3  =0.0, 
     X 4  =0.5, X 5  =0.5, X 6  =1.0, X 7  =1.0, 
     X 8  =1.0, X 9  =1.0 
     Although the parameter &#34;t&#34; changes in the interval X 0  ≦t&lt;X 9 , the intervals where the parameter actually change are X 3  ≦t&lt;X 4  and X 5  ≦t&lt;X 6 . 
     In the interval 0=X 3  ≦t&lt;X 4  =0.5, calculating first rank basic function on the basis of the equation (2), we obtain 
     N 0 .1 =0, N 1 .1 =0, N 2 .1 =0, N 3 .1 =1, 
     N 4 .1 =0, N 5 .1 =0, N 6 .1 =0, N 7 .1 =0, 
     N 8 .1 =0 
     Substituting the above data for the equation (3) and calculating cases of k=2 and k=3 in the equation (3) in order, values of N 0 .4 (t), N 1 .4 (t), N 2 .4 (t) . . . N 5 .4 (t) in the above equation (5) can be obtained (in the calculation of the equation (3), when the denominator of the first or second term in the right side of the equation become zero &#34;0&#34;, the fraction thereof inevitably become zero &#34;0&#34;; in this case, the calculation is made as 0/0=0). 
     Specifically, 
     
         N.sub.0.4 (t)=-8t.sup.3 +12t.sup.2 -6t+1 
    
     
         N.sub.1.4 (t)=24t.sup.3 -24t.sup.2 +6t 
    
     
         N.sub.2.4 (t)=-20t.sup.3 +12t.sup.2 
    
     
         N.sub.3.4 (t)=4t.sup.3 
    
     
         N.sub.4.4 (t)=0 
    
     
         N.sub.5.4 (t)=0 
    
     In the interval X 3  ≦t&lt;X 4 , the initial value t=0 is set, and |&lt;P&#39;(0)&gt;| is calculated, and then, Δt 1  is obtained from the equation (4). 
     Whereupon, from the equation (5), the vector of the interpolation point &lt;P(t+Δt 1 )=&lt;P(Δt 1 )&gt;is as follows: 
     
         &lt;P(Δt1)&gt;=N.sub.0.4 (Δt.sub.1)&lt;P.sub.0 &gt;+N.sub.1.4 (Δt.sub.1)&lt;P.sub.1 &gt;+N.sub.2.4 (Δt.sub.1)&lt;P.sub.2 &gt;. . . N.sub.5.4 (Δt.sub.1) &lt;P.sub.5&gt; 
    
     From the interpolation point thus obtained, |&lt;P&#39;(Δt 1 )&gt;| is calculated, and Δt 2  is calculated from the equation (4), in order to obtain a vector &lt;P(t+Δt 1  +Δt 2 )&gt;=&lt;P(Δt 1  +Δt 2 )&gt;which is the vector of a new interpolation point. 
     Likewise, if interpolation points are successively calculated, from the equation (5), these interpolation points are as follows: 
     
         &lt;P(0)&gt;(initial value) 
    
     
         &lt;P(Δt.sub.1)&gt;; 
    
     
         &lt;P(Δt.sub.1 +Δt.sub.2)&gt;; 
    
     
         &lt;P(Δt.sub.1 +Δt.sub.2 +Δt.sub.3)&gt;; 
    
     
          . 
    
     
          . 
    
     
          . 
    
     
         &lt;P(Δt.sub.1 +Δt.sub.2 +Δt.sub.3. . . . . . +Δt.sub.i)&gt;. 
    
     In this case, if the value of Δt 1  +Δt 2  +Δt 3 . . . . . . +Δt i  exceeds 0.5, P(0.5) is set. 
     Also, vectors in the case of the interval X 5  ≦t &lt;X 6  can be calculated in the same manner as the aforesaid interval. 
     FIG. 6 is a diagram showing the relationship between control points and the NURBS curve. This diagram shows a NURBS curve interpolated according to the first NURBS curve interpolation start command of NC programs shown in FIG. 5. Further, in the diagram, the first through sixth control points are represented by P 0  through P 5 , respectively. In this manner, a smooth curved line is formed in accordance with positions of respective control points. 
     FIG. 7 is a diagram showing an interpolation path according to NC programs shown in FIG. 5. According to the first NURBS curve interpolation start command, the interpolation from the first control point P 0  to the sixth control point P 5  is executed. Then, the linear interpolation to the control point P 6  is executed, and thereafter, the interpolation from the seventh control point P 6  to the twelfth control point P 7  is executed according to the next NURBS curve interpolation start command. Further, the interpolation to the thirteenth control point P 8  which is the next NURBS curve interpolation start position is executed, and subsequently, an interpolation is executed likewise. 
     As described above, the NURBS curve interpolation can be instructed to the CNC by specifying the smallest volume of data necessary for identifying a profile of the NURBS curve. Therefore, there is no need for dividing a free-form curve represented by the NURBS curve into small straight lines, small circular arcs, etc., as is necessary in the case of the prior art, so that NC programs can be simplified. Thus, NC programs are simplified to reduce the amount of the data, so that data transmission between the host computer and the CNC can be performed at a high speed. In addition, NC program analysis processing in the CNC can also be performed at a higher speed. 
     Moreover, in determining the interpolation path of a free-form curve, there is no need for executing an approximation calculation, so that machining accuracy can be improved.