Rough machining nc data creation method
BACKGROUND OF THE INVENTION 
     1. Technical Field 
     This invention relates to a method of creating NC data for rough machining and, more particularly, to an NC data creation method for subjecting a workpiece to rough machining using surface data obtained by digitizing a model surface. 
     2. Background Art 
     A method is available for creating NC data, which is for performing machining in accordance with the shape of a model, using model-surface data (position indicative of the center of a stylus) digitized by tracer control. 
     FIGS. 13(a) and (b) are explanatory views in which surface data of a model MDL are digitized by two-way tracing of an X-Z surface. FIG. 13(b) is a partially enlarged view. A stylus STL is transported along the X axis at a predetermined tracing velocity and moves up and down along a model MDL in the Z-axis direction, and three-dimensional position data (coordinates) of the stylus are read in and stored at predetermined times or whenever a see value exceeds a tolerance value. A predetermined amount of pick-feed is performed along the Y axis when the boundary of a tracing region TRR is reached. Thereafter, while similar surface tracing is being performed, the position of the stylus STL is monitored, the surface of the model MDL is digitized by reading in the position data, and NC data are subsequently created using the surface data. 
     When NC data for rough machining are created using position data digitized by such tracing and machining is performed based on the NC data while effecting a tool-diameter offset using a tool TL whose diameter R is larger than a diameter r of the stylus STL, the tool TL is obstructed by the workpiece WK and may be broken or caused to cut in too deeply (see FIG. 14). Accordingly, the applicant has already proposed a method of checking for interference by a rough machining tool and of correcting tool path in a case where interference will occur. 
     In accordance with this proposal, and assuming that the model surface has been approximated in step-shaped fashion using the digitized position data and that a predetermined point on each horizontal shape approximating surface is one point constituting a tool path, a point is checked to determine whether the tool interferes with other shape approximating surfaces when the center Pc of the tool is situated at a position obtained by a tool offset from the abovementioned point. In a case where interference will occur, the position Pc of the tool center is moved correctively to a height to avoid interference and the NC data for rough machining are created based on the tool position following the correction. 
     With this conventional interference checking method, however, a check to determine whether the tool TL will interfere with a shape approximating surface Sa is not carried out while the tool moves from a tool position Pck&#39; (FIG. 15) to a subsequent tool position Pc(k+1)&#39;. Consequently, the tool may interfere with the workpiece at the time of machining, and if machining is performed under these conditions, the tool may break or cut in too deeply. 
     Accordingly, an object of the present invention is to provide a method of creating data for rough machining in which a tool will not interfere with a workpiece when the tool is moved from one tool position to the next tool position. 
     SUMMARY OF THE INVENTION 
     In accordance with the present invention, the foregoing object is attained by a step of partitioning a distance between a target tool position and an immediately preceding actual tool position into a plurality of segments between partitioning points while the distance between the partitioning points is greater than a predetermined value, a step of checking to determine whether the tool will intersect a model approximating surface at each partitioning point, and in a case where intersection will occur, a step of correcting tool position at each partitioning point in a height direction in such a manner that intersection will not occur. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIGS. 1(a) and 1(b) are views for describing the general features of the present invention; 
     FIG. 2 is a block diagram of an apparatus (digitizer) for realizing the present invention; 
     FIG. 3 is a flowchart of processing for creating NC data for rough machining according to the present invention; 
     FIG. 4 is a view for describing tracing region and meshes; 
     FIG. 5 is a view for describing digitizing points and a shape approximating surface; 
     FIG. 6 is a view for describing an interference check; 
     FIG. 7 is a view for describing a shape approximating surface which is the object of an interference check; 
     FIGS. 8 and 9 are views for describing an interference check; 
     FIG. 10 is a view for describing a method of correcting digitizing points in case of interference; 
     FIG. 11 for describing points on two adjacent offset paths; 
     FIGS. 12(a) and 12(b) are explanatory views for correcting a rough machining path; 
     FIG. 13(a) and 13(b) are views for describing a digitizing method; and 
     FIGS. 14 and 15 are views for describing the problems of an example of the prior art, 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 1 is a view for describing the general features of a method of creating NC data for rough machining according to the present invention. It will be assumed that the model surface has already been approximated in step-wise fashion, and that processing for rough machining NC data has proceeded up to a point Pc(k-1)&#39;. In creating a rough machining path from the present tool position Pc(k-1)&#39; on a horizontal shape approximating surface to a tool position Pck&#39; on the next horizontal shape approximating surface, first a traveling distance Ki between the next tool position Pck&#39; and the present tool position Pc(k-1)&#39; is obtained, the distance Ki and a predetermined value L are compared in size, and when Ki&lt;L holds, NC data for rough machining are created in such a manner that the tool will move linearly between the tool position Pck&#39; and the present tool position Pc(k-1). On the other hand, when the distance Ki is greater than the predetermined value L [see FIG. 1(a)], this distance is partitioned into a plurality of set distances l 0 , and a check is performed at each partitioning point Pnj (j=1, 2, . . . ) to determine whether the tool TL will intersect the shape approximating surface Sm. In case of intersection, the tool position of each point Pnj is corrected in the height direction so as to avoid intersection, and the rough machining NC data are created in such a manner that the tool will pass the tool position Pnj&#39; [see FIG. 1(b)] resulting from the corrective processing. 
     FIG. 2 is a block diagram of an apparatus (digitizer) for realizing the method of the present invention. Numeral 1 denotes a digitizer equipped with a digitizing function for accepting and digitizing the present position of a tracer head while tracer control is being performed, as well as an NC data creation function and a tool interference checking function. The apparatus has a processor 1a, a ROM 1b storing a control program, a RAM 1c for storing digitized position data, and a working memory 1d. 
     Numeral 2 denotes an operator&#39;s panel having functions for inputting various operation signals and setting tracing conditions at the time of digitizing, tracing region TRR (see FIG. 4), tracing method, vertical and horizontal dimensions of meshes M(i,j), described below, tool radius R, and the like. 
     Numerals 10X, 10Y, 10Z denote DA converters for converting velocity data (digital values) along respective axes commanded by the digitizer 1 into analog velocity signals Vx, Vy, Vz. Numerals 11X, 11Y, 11Z denote X-, Y- and Z-axis servo circuits, respectively, 12X-12Z denote X-, Y- and Z-axis motors, respectively, and 13X-13Z represent pulse generators for generating single pulses Xf, Yf, Zf, respectively, each time the corresponding motors rotate through a predetermined angle. Numeral 14 designates a present position register for reversibly counting the pulses Xf, Yf, Zf, in accordance with the direction of movement, to store the present positions along the respective axes. Further, TH represents a tracer head, STL a stylus, and MDL a model. 
     FIG. 3 is a flowchart of processing for creating NC data for rough machining according to the present invention. Processing for creating NC data for rough machining according to the present invention will now be described in accordance with the flowchart of FIG. 3. It will be assumed that the tracing region TRR (see FIG. 4) and the vertical and horizontal dimensions of each mesh have already been entered from the operator&#39;s panel (see FIG. 2), and that the tracing region TRR has been partitioned into m x n meshes Mi,j (i=1-m, j=1-n). Further, it will be assumed that a distance L (e.g., a value, which is 1/4 of the tool diameter, for minimizing cut-in), which serves as a reference in the case where the distance Ki described in FIG. 1 is partitioned, has also been entered from the operator&#39;s panel 2. 
     Surface two-way tracing is carried out with the X, Y and Z axes serving as a feed axis, tracing axis and pick-feed axis, respectively. In concurrence with this tracing operation, surface data are created by accepting the coordinates of the stylus positions (positions indicated by the black dots in FIGS. 4 and 5) by well-known digitizing processing at predetermined times or whenever a set value exceeds a tolerance value, and the surface data are stored in the RAM 1c (steps 101, 102). 
     In concurrence with creation of the surface data, representative points of the meshes M(i,j) are obtained by a method, described below, and these points are stored in the working memory 1d. Specifically, storage areas for storing three-dimensional coordinates are established in the working memory 1d to correspond to the meshes M(i,j). Whenever the stylus position is accepted by digitizing processing, the position of contact between the model MDL and the stylus STL are obtained from the stylus position and a displacement quantity, and a check is made to determine to which mesh the contact position belongs. When the mesh M(i,j) to which the contact position belongs has been obtained, a check is made to see whether the contact position is an initial position of the mesh M(i,j). If the contact position is the initial position, a Z coordinate zn of the contact position is stored in the storage area of the mesh M(i,j). If the contact position is not the initial position, the Z coordinate (z o ) stored in the storage area corresponding to the mesh M(i,j) and the Z coordinate (zn) of the contact position are compared. If 
     
         z.sub.o ≧zn 
    
     holds, the content of the storage area is not updated. If 
     
         z.sub.o &lt;zn 
    
     holds, zn is stored in the storage area (zn→z o ). If this processing is executed whenever the stylus position data are digitized, the coordinates of points having the largest Z coordinates among the points belonging to the meshes M(i,j) are stored in the storage areas of the working memory 1d that correspond to the meshes M(i,j). The machining shape in each mesh is approximated, in step-wise fashion, by a surface (referred to as a &#34;shape approximating surface&#34;) S(i,j) (see the dashed line in FIG. 5) having the height of the representative point (step 103). 
     Next, the coordinates of the digitized points having the largest heights in the meshes are stored in the RAM 1c mesh by mesh, and these serve as points constituting a tool path for rough machining. It should be noted that the mesh center point of the shape approximately surface may be employed as a digitizing point for rough machining. 
     Thereafter, when the tool is offset by the tool diameter from the abovementioned point on the shape approximating surface, it is checked to see whether the tool will intersect the shape approximating surface (see FIG. 6). It should be noted that the shape approximating surfaces which are the object of the intersection check are those conforming to meshes (among which are meshes intersected) residing within the line (see the dashed line in FIG. 7) defining the external shape of the projection of the tool onto the XY plane. 
     The check to determine whether intersection occurs will be described hereinafter with reference to FIG. 8. Specifically, with regard to shape approximating surfaces corresponding to meshes M(i,j-2), M(i,j-1), M(i,j+1), M(i,j+2), M(i-2,j), M(i-1,j), M(i+1,j), M(i+2,j) in the same column and row as that of the mesh M(i,j) to which the center of the tool belongs, points of intersection between straight lines PX, PY, which pass through the position of the tool center and lie parallel to the X and Y axes, and the each mesh line are obtained, and points on shape approximating surfaces S(i,j-2), S(i,j-1), S(i,j+1), S (i,j+2), S(i-2,j), S(i-1,j), S(i+1,j), S(i+2,j) are obtained, these points being the projections of the abovementioned points of intersection). The tool radius R is compared with the distances from the tool center Pc to points on the shape approximating surfaces. If the distance is shorter than the tool radius, it is judged that intersection will occur. If the distance is greater, it is judged that intersection will not occur. With regard to shape approximating surfaces corresponding to meshes in the diagonal directions of the mesh M(i,j), points on the shape approximating surfaces corresponding to the corner points of each of the meshes nearest the tool nose position are obtained, after which a check made to determine whether the distance from the tool center to each point is shorter than the tool radius R. If it is shorter, it is judged that intersection will occur; if it greater, it is judged that intersection will not occur. 
     In the case of non-intersection, the tool center position is stored in the RAM 1c as a point on an offset path along which tool interference will not occur. 
     In case of intersection, on the other hand (see FIG. 9), an amount of movement d (see FIG. 10) along the Z direction which will prevent the tool from interfering with any shape approximating surface is obtained. 
     Thereafter, assuming that the coordinates of the tool center Pc are (xi,yi,zi), the coordinates (xi,yi,zi+d) are stored in the RAM 1c as a point Pc&#39; on the offset path along which tool interference will not occur (step 104). 
     Each time a point on the offset path is found, the processor 1a computes the distance Ki between the point Pck&#39; (FIG. 11) on the latest present offset path and point Pc(k-1)&#39; on the immediately preceding present offset path, and it is determined whether the distance Ki is greater than the predetermined distance L (e.g., a value that is 1/4 of the tool diameter) (step 105). If the distance Ki is greater than the predetermined value L, processing from step 109 onward, the processing from step 109 onward is performed. 
     If the distance Ki is greater than the predetermined value L, on the other hand, an integral value n is found. This value is obtained by dividing the distance Ki by the predetermined distance L and raising the remainder. The distance Ki is partitioned at the integral value n. Let the N-number of partitioning points obtained be new tool center positions Pnj (j=1, 2, . . . N) [see FIG. 1(a) and FIG. 12(a); step 106]. 
     Next, it is checked at each point Pnj to see whether the tool having the radius R intersects a shape approximating surface. In case of intersection, an amount of movement along the Z direction for moving the tool TL until it will no longer interfere with any shape approximating surface is found. (By way of example, a sphere of radius R whose center is the point Pnj is found, and the amount of movement along the Z direction is that up to the position at which the sphere is tangent to the shape approximating surface.) Thereafter, each point Pnk is corrected in the height direction using the obtained amount of movement in the Z direction, and the corrected point Pnj&#39; [see FIG. 1(b) and FIG. 12(b)] is stored in the RAM 1c as a point on the offset path. On the other hand, in a case where the tool does not interfere with the shape approximating surface at point Pnj [see point Pn 1  in FIG. 12(b)], the tool is moved in the Z direction to the position of contact with the shape approximating surface to effect a correction to Pn 1  &#39; (step 107). 
     Next, it is determined whether the correction has ended with regard to all of the N new tool center positions Pnj obtained by partitioning (step 108). If the correction has not ended, processing from step 107 onward is repeated. 
     On the other hand, if the correction has ended for all of the N new tool center positions Pnj obtained by partitioning, it is then determined whether processing has ended with respect to all points conforming to the mesh (step 109). If processing has not ended, points on the next mesh are read from the RAM 1c (step 110) and processing from step 104 onward is repeated. 
     When processing regarding all digitized points for rough machining has ended, the processing for creating the NC data for rough machining is terminated. 
     Thus, in accordance with the present invention, when the traveling distance between the next target tool position and the present tool position is less than a predetermined value, NC data for rough machining are created in such a manner that the tool moves linearly between the two tool positions. When the distance is greater than the predetermined value, this distance is partitioned into a plurality of distances and a check is performed at each partitioning point to determine whether the tool intersects a shape approximating surface. In case of intersection, tool position at each partitioning point is corrected in a height direction in such a manner that intersection will not occur, and NC data for rough machining are created in such a manner that the tool position resulting from the correction is traversed. As a result, the tool will no longer interfere with the workpiece when the tool is moved.