Accuracy of the New Method of Alignment of Workpiece Using Structural-Light 3D Scanner

This paper presents a new method of aligning workpieces for machining by means of optical measurements followed by the results of verifi cation tests of this method. The overview of modern assessment methods of irregularly shaped blanks are discussed in this study, with particular emphasis on cast iron castings, as well as on problems related to their positioning and fi xing for machining. A fl owchart of the proposed method and its verifi cation results in industrial conditions are also presented. The essence of the method is based on the comparison of two spatial models: a designed workpiece model and the actual model of a casting produced with a coordinate measuring technique. A series of six iron castings were tested. The obtained results indicate that the errors caused by locating amounted to a maximum of 2 mm (average 0.5 mm) and were three times lower than actual machining allowances. This points to the correctness of the developed method and the great potential for its industrial application. Additionally, a method for improving locating accuracy by modifying the shape of the retaining pin is presented.


INTRODUCTION
Preparation of workpieces for machining includes their evaluation, determination of machining bases and fi xing them within machining space. The evaluation becomes particularly challenging in relation to blanks with irregular and complex geometric shapes. This mainly concerns castings, and among those cast iron castings are a special subgroup. Those used in machine tool industry are characterized by a small and medium production volume, which determines their production technology, i.e. sand casting. According to applicable standard [1] this method has relatively low accuracy and repeatability, therefore it becomes important to evaluate the geometry of at least the fi rst casting in a given casting batch. This is usually performed in a traditional way, by means of marking. A blank is placed on adjustable supports on the marking table and aligned with the selected machining bases which are usually the most important in terms of the intended design or has the largest machining surface. For each machined surface, lines are drawn on the casting surfaces, to mark the material tobe-removed (Fig. 1a). The information of the machining allowances on each of the surface is crucial for designing the NC program, to avoid any possible collision during machining.
The prerequisite for a positive evaluation is a presence of a machining allowance on each of the machined surfaces as indicated by the marking lines. Those lines are then used to position the blank in the fi xture by means of a height gauge. The blank is placed on adjustable supports (usually threaded pins), the length of which is adjusted so that the drawn line is horizontal. The correctness of such setting is verifi ed in the machining space using a NC centre drill -by reaching intersection axis of the marked lines (Fig. 1b), or a tool probe -by measuring the characteristic dimensions of the blank.
Activities related to manual assessment of blank geometry lengthen the process of preparing casting for machining. They are difficult to automate and considered not very accurate. In addition, setting and verifying blank position in machining space reduces machine tool productivity [2]. These problems were the genesis of the application of measuring systems for faster evaluation of workpieces, especially in the form of castings [3].
The general concept of using an optical scanner to align workpieces within the machining space, as well as the original method, was presented by the author in the article [4]. The main idea is to compare the scanned casting with the designed workpiece with the use of best-fit method. By matching both models with the best-fit method, you can get at the same time the optimization of the distribution of machining allowances. As a result, it is possible to reduce the total volume of the material removed by approx. 10%. The results of such an analysis were presented by the author at a conference in San Diego [5]. The disadvantage of this method is the need to scan the entire geometry of the workpiece. The reduction of the measurement time is possible thanks to photogrammetric measurement systems. However, they do not give the full picture of the geometry, but only a cloud of points distributed on the casting. Nevertheless, there are known the results of research on the use of photogrammetry for automatic aligning of large-size workpieces are also known [6]. The disadvantage of this solution is the need to perform photogrammetric measurements within the machining space, which extends the entire process and shortens the effective time of using the machine tool.
In this context, it is worth noting that research is currently being carried out to develop methods of active evaluation and workpiece positioning in machining space with various types of measurement systems. Trials of such applications with optical scanners have been presented in [7,8], test results of measurement strategy for quick determination of blank position in [9], accuracy assessment of optical measurements in machining space in [14] and minimizing errors of fixturing by adjusting the machining coordinate frame [15]. Optical systems in quality control of cast blanks are successfully used for large-size workpieces [16], simultaneously allowing detection of specific defects, such as moulding sand contamination of the casting [16]. Optical systems are also used to improve ergonomics, efficiency and operator safety by introducing a virtual reality-based interface [18].
Additionally, a comparison was made with the first method of positioning blanks based on their geometry scanning -that was developed by the authors and described in [4]. The result of this comparison can be seen in right column in Table 1. It is clear that this method is the fastest among the 3 methods used in this company. Compared to the setting method with the touch probe, a saving of 12 minutes of set-up time in the machining space is made.
The results of research on the use of models of measured workpieces as models of machined parts in CAM systems are also known [15]. The key in these applications is the appropriate alignment of the scanned model with the CAD model. Table 1 shows the results of tests carried out in a factory which manufactures CNC machine tools. They showed that the average time According to industrial practices of the aforementioned manufacturer, only the first piece is marked out in order to assess the amount of allowances on all machined surfaces when highquality castings with repeatable geometry are considered. Marking lines are used to position the first casting in the jig, and each subsequent casting, without marking lines, is positioned in the same way. Both the correctness and possible correction of the setting of each casting is confirmed by measuring the control points with the use of a touch probe. In this way (my means of the touch probe), the time of preparing the casting for machining is reduced from 46 to 27 minutes; however, the need to position the blank in the machining space significantly extends the downtime of the machine tool: 16 minutes instead of 8. Machining parts on milling machines requires their locating, i.e. removing indispensable degrees of freedom and supporting [21]. Blank locating is also associated with obtaining its correct orientation in machining space. Proper workpiece supporting and fixing, although commonly performed in all factories dealing with mechanical machining, is a difficult and challenging task.
As a rule, low rigidity blanks require their overconstraining prior to machining by introducing excessive locating points [28]. Blank overconstraining calls for introduction of machined technological bases or precise setting of support lengths, because any errors in this area will result in deformation of the part being fixed.
There is known a concept of intelligent fixture for miminimizing the workpiece deformation. Unfortunately, the results of its effectiveness are lacking [17]. Special machining holders are used that mimic the shape of selected surfaces of the blank using a magneto-rheological liquid [18]. Another approach may be a device that adapts to the shape of a thin-walled object, made of with a low-melting alloy as shown in Figure 2 [19].
A potential solution to these problems is to select the length of the excess supports in a way that minimizes the risk of deformation of the blank. One of the ways is to determine the length of supports individually for each casting based on the measurement of its geometry. Additional transport to the machine 4 0 4 Leveling on the machine's external pallet 5 5 3 Fixing on the machine's external pallet 6 6 6 Adjusting, checking settings in X, Y, Z, C axis (inside the working space) 8 16 4 Total 46 27 25

Aim of study
This article aims to present and verify in industrial conditions a new method of positioning of blanks in the form of cast iron castings based on optical measurements. As part of research work: • a method of evaluating cast iron blanks was developed, • a method of positioning cast iron blanks was developed, • a method of blank positioning was verifi ed in industrial conditions and its precision was determined.
On the basis of results obtained, a possibility of collision-free machining of the blanks positioned according to the developed method was confi rmed.

METHOD
The authors of the paper developed a method of evaluation and fi xing blanks using a structuredlight 3D scanner [4]. The essence of the method is based on the comparison of two spatial models: a designed workpiece model WPM and the actual model AM of a casting produced with a coordinate measuring technique. A structured light scanner was used in the study. The method is based on the assumption that a designed 3D model of the WPM workpiece (blank) is available, but it is also allowed to use the designed model of the workpiece after machining, which is due to the fact that usually in factories manufacturing casting based products, the engineer designs the part using asmachined surfaces, while necessary machining allowances, technological inclinations, etc. are added by blank manufacturer (foundry).
For the purpose of testing various blanks, a special measuring frame was designed and made, enabling stable positioning of the measured object at a height that makes it possible to measure lower surfaces. The frame was designed with dimensions adapted to the size of the rotary table of the robotic measuring cell (ScanBox 6130 by ATOS), with extruded aluminium profi les connected with system connectors, allowing for quick change in their position. Vertical -support -profi les, had plastic heads, on which the casting being measured rested. Reciprocating position of support profi les depends on the shape of the measured casting and is set according to a dedicated instruction. The measurement program was developed in a virtual environment using 3D models of the frame and the measured casting. In order to shorten the time of casting preparation for measurements, reference points glued onto the measured part were replaced with special adapters attached to casting with magnets. Figure 3 shows the frame model with the casting being measured in a virtual environment and during measurements.
The use of several possible scanning system software algorithms was considered that would orientate the actual casting model (AM) against the designed model (WPM). The basic algorithm used during the research was so-called "Best fit" -a method of the best fit between both geometries. This algorithm searched for such orientation and location of both models that the sum of normal distances between points on all surfaces of both models took the minimum. A similar algorithm was also tested ("best fit on selected surfaces"), for which the orientation and location in which the sum of the distances of points on the selected surfaces of the model was minimized was searched. In this method, the search was limited to the largest areas and those of the greatest design significance. In the third algorithm, the possibility of alignment using three mutually perpendicular surfaces to be machined was examined, taking into account a possible shift due to machining allowance. The evaluation of the casting was performed using a color-coded map showing distances between surfaces of the measured and reference models. This map was generated after following an appropriate orientation of both models and displayed, as required, on the surfaces of the real or reference models. The colors should be interpreted as follows: green means that the surfaces of the measured and reference models correspond, yellow turning into red means a positive deviation (too much material), and blue means a negative deviation, i.e. no material. In the tests, a cast after machining was used as a reference model. That is why a positive deviation (yellow) usually indicates a machining allowance and does not indicate a defect in the blank.
In order to obtain information on casting setting for machining, a coordinate system CS WPM was defi ned in the model of the designed object (after machining), which was in accordance with the system set for machining (Fig. 4) as well as points fi xing the blank in the number resulting from the adopted determination method. Their minimum number was at least: 3 points fi xing the object vertically -the Z axis of the CS WPM system (P uz1 ,P uz2 , P uz3) , 2 points fi xing the object in one of horizontal directions -e.g. X (P ux1, P ux2 ), and 1 point fi xing the object in the other horizontal direction -e.g. Y (P uy1 ). In industrial practice, the number of support points is often increased to ensure adequate support stiff ness. In this case, the number of relevant points (P ux , P uy , P uz ) will be similarly greater.
Then points were created on the surfaces of the actual casting (AM) by projecting fi xing points in directions perpendicular to the surface of the workpiece. In the next step, the position of the planes: the machine table P MT in relation to the CS WPM workpiece coordinate system and the planes fi xing the device in P Ux and P Uy machining space were determined. The required settings (support lengths) of the machining tool were calculated: • at points fixing workpiece in Z direction as the distance from the points lying on surfaces of actual blank to the plane of machine tool table P MT , • at points fixing workpiece in X direction as the distance from the points lying on surfaces of actual blank to the P Fx plane fixing the device in machining space, • at the points fixing workpiece in Y direction as the distance from the points lying on surfaces of actual blank to the plane P Fy fixing the device in machining space.
The machining fixture is set in such a way that the length of the setting pins l n measured from the plane of the machine table P MT and the planes fixing the device in the machining space P Ux and P Uy correspond to the calculated values. The diagram of setting up the device in accordance with the developed method is shown in Figure 5, and technological tests of correctness of machining are shown in Figure 6. Points P1, P2, P3, P4 fix the blank on the plane; points P5, P6 orientate it angularly, point P9 fixes the blank in the direction of X axis, and points P7, P8, P10 fix the blank in the horizontal plane. The setting determines the length over which a given retaining pin must be extended in order for the blank to be set in accordance with the method.
The flowchart of the developed method is presented in Figure 7. It has been patented [53, 54, 55] and is used in a company manufacturing machine tools.
The presented method of positioning the blank does not take into account possible casting deformation resulting from gravitational forces -a model of a perfectly rigid body was compared with a casting model measured in measuring fixture.

CASE STUDY
The tests were carried out on a production batch consisting of 6 headstock castings of a milling centre. The overall dimensions of the blank were 1200 x 750 x 400 mm, and its weight before machining was 326 kg. Two measurement systems were used in the study: Atos II GOM and Atos Triple. The first system in an automated measuring cell measured the entire geometry of the blank for evaluation and setting. The blanks for measurements were placed in a reconfigurable measuring fixture. Each casting was measured under the same ambient conditions and using the same measurement program.
As a result of the measurements, spatial models in the STL format were obtained. Unlike previous studies that used the best-fit method, they were aligned to the CAD model with the use of three surfaces, which constitute the technological datums of the casting Since the measured surfaces of the casting are replaced with planes determined by calculation algorithms, they are not perfectly perpendicular to each other (as opposed to the planes of the reference model), in the CAD model the three perpendicular flat surfaces were also replaced with planes. Then, at the intersection of two of them, an axis was created, and a point was created at the intersection of this axis and the third plane. The reference features of the measured casting selected in this way were aligned to the analogous features of the CAD model. The way of aligning is presented on the Figure 8. All the blanks passed the accuracy evaluation -on each surface machined the allowance value was within acceptable limits, as defined by the company's internal standard. A sample report is shown in Figure 9.
Castings for the first machining operation were set with 6 fixture points: three levelling the casting (P1, P2, P3), two orientating angularly (P4, P5) and one bumper setting the position in the direction of X axis (P6). The casting support points are adjusted with threaded pins. The casting is fixed with pressure jaws. The view of the machining tool with fixing points marked and the blank mounted in it in nominal (anticipated) position is shown in Figure 10.
The settings of machining fixture for each blank were calculated according to the method developed and discussed earlier. At the locating points, distances between the surface of the measured model and the reference CAD model in the directions of the main axes of the coordinate system were determined (D m ). Typical values of these differences for the selected casting are presented in Table 2 in the column "measured deviations". Nominal setting (S n ) value equals the distance between the reference surface of the machining fixture and the reference CAD model surface in the particular support point. The difference between this dimension (S n ) and the measured deviation (D m ) is the length of the retaining support that is searched: The accuracy of setting according to the developed method was tested by analyzing measurement result of a blank ready for machining, i.e. set in a machining tool mounted on a tool pallet. Both casting geometry and surfaces of the table and the machining tool were measured. An Atos CompactScan 5M scanner mounted on a mobile tripod was used for this measurement. Measurements were made manually in such a way as to ensure a similar number and orientation of measurement shots for each casting measured. The method for measuring the casting mounted in the jig is shown in Figure 11a, and the scanned cast with parts of the device and of the table can be seen in Figure 11b.  After defining coordinate system in the scanned casting model in the device, it was exported to an STL file, and then loaded into GOM Inspect software as an Actual element. Similarly, a model of the same casting scanned for evaluation and setup was exported and loaded into the same project as CAD. Both models were compared in inspection module. Figure 13 shows color-coded maps from the comparison of both models.
For further analysis, 16 control points were set on the machined surfaces, 4 on each plane of the coordinate system. The distribution of these points is shown in Figure 14, and the deviation values are in Table 3.
In most cases, deviation values did not exceed 0.5 mm. The smallest error values were recorded in the direction of X axis. In this direction, the blank was fixed on 3 pins. Maximum error of    In Y direction, the blank was fixed with 2 pins. The greatest deviations were recorded in this direction. Among them, deviations measured on left side of the blank were about twice as large as those on the opposite side. In Z direction, the blank was characterized by the shortest dimensions and was supported on one retaining pin. In this direction, deviations of relatively low values, mostly below 0.5 mm, were recorded. These deviations were characterized by the smallest range.
The highest fixing error was -2.13 mm. A negative value indicates that the surface of the blank at this point was lowered in relation to anticipated position. According to foundry standard minimum value of machining allowance for these blanks is 3 mm. On the other hand, values measured at these points were between 6 and 9 mm. It should therefore be concluded that such a misalignment, despite a negative direction and relatively high value, will not adversely affect possibility of correct machining.

Error analysis
Errors in determining blanks tested ranged from 0.01 to 2.13 mm. The mean error value was 0.21 mm. On the basis of results obtained, it was found that the blank was correctly levelled in 3 locating points -the maximum measured deviation in the vertical direction was 0.67 mm, and most deviations were below 0.3 mm. Fixing blanks in longitudinal direction (measuring direction Z) showed similar accuracy. The maximum deviation in this direction was 0.56 mm. The greatest errors in casting positioning in the device occurred in the direction of Y axis. These errors are characterized by asymmetry and point to casting being twisted around vertical axis. The source of the error was identified in the area of fixing the blank in the direction of Y axis -a retaining pin with a flat tip supported the casting on the surface with a casting inclination (Fig. 15).
When calculating the length of the pin, it was assumed that the point of contact with the surface of the casting would occur in its axis. In this particular situation, however, contact occurred at the edge of the retaining pin. For the diameter of the fixing pin M12 and casting inclination α = 5 °, at the point analyzed it introduced a shift error e of 0.9 mm. In order to eliminate such potential errors in the future, two solutions have been developed. The first is to modify the shape of the retaining pin -the flat tip has been changed to a spherical one with a radius r tu . According to the diagram in Figure 16, for casting inclinations below 5°, this will allow the determination error to be limited to a maximum of: e = r tu (1cosα) [mm] (1) For the case under study, the error of 0.9 mm, after changing the pin shape to a rounded radius of 6 mm, will theoretically be reduced to 0.023 mm.
The second solution requires a change in the method of determining the length of retaining pin. The actual setting point lying on the

CONCLUSIONS
We can fi nd many concepts for the use of optical systems to facilitate the process of positioning blanks. However, there is no information on the implementation of these concepts, as well as their qualitative assessment -the accuracy obtained, also in relation to technological requirements. The presented method has been implemented in the company producing machine tools and has successfully replaced the existing procedures for assessing and setting workpieces. The performed tests of the accuracy of aligning with this method allowed to defi ne its limitations.Based on the studies conducted, following conclusions were drawn: • errors measured in determining blanks with the method developed were maximum 2 mm, and on average 0.5 mm, • maximum determination errors are 3 times smaller than machining allowances made, which for the tested castings are 6 mm, • an important issue is the shape of the pin supporting the blank, it should provide small positioning errors and, at the same time, a suffi cient contact surface (minimizing plastic and elastic defl ections), • attention should be paid to cleanliness of contact points of retaining pins with blanks, • possible invisible contaminants, such as e.g.
painted mold residues, may result in pin being dented and, as a result, increase determination error, • setting points in a given direction should be spaced as far apart as possible, which will reduce infl uence of error of setting the length of fi xing pins on the error of blank fi xing. • changing retaining pin shape allows for a multiple reduction of theoretical setting error, therefore, subsequent tests will be carried out with the use of spherical supports, • it is possible to further increase the accuracy of workpieces aligning by applying technological corrections -spherical pins or another method of determining the length of the support.