A Prototype Two-Axis Laser Scanning System used in Stereolithography Apparatus with New Algorithms for Computerized Model Slicing

: Problem statement: A successful operation of rapid prototyping process depends on software and hardware which are used in RP machines. About software, an efficient technique is required to slice the CAD model. Several slicing methods are used for slicing from Standard Triangulation Language (STL) files, such as direct slicing and adaptive slicing. Using these methods reduce accuracy of physical part or increase process time. About hardware, in Stereolithography (SLA) apparatus, two mirrors have been used to reflect laser beam. Approach: In this study new algorithms were developed for part slicing from STL file and modifying the laser beam path such as: Derivation of contours in each layer, generate contour family tree, detective arcs and modifying laser beam path. A modified mechanism was designed and developed based on only one mirror to reflect laser beam. Results: These algorithms were used in a visual basic interface and the developed mechanism was implemented in a prototype apparatus. Conclusion: Developed algorithms decreased CAD model slicing time and generated more accurate laser beam path than usual methods and fabricated apparatus decreased scanning mechanism complexity and volume of the scanning system.


INTRODUCTION
Rapid Prototyping (RP) produces a physical prototype from a CAD model by building a part layer by layer in shorter time than more traditional prototyping methods. Unlike the traditional material removal processes, most rapid prototyping processes have to build a physical model by gradually adding or solidifying materials layer by layer [1] . This research is concerned on a new approach of software and also hardware of RP.

Software:
In RP, CAD model must be sliced in to cross sections by specific z plane with uniform or different increments along z axis. Different methods for this purpose are used. Some of them are based on STL format and the others based on CAD model directly as shown in Fig. 1.
STL format slicing: STL file is a standard format of tessellating and approximating surfaces of a CAD model with triangles. By intersecting these triangles with specific z plane, contours of a cross section can be derived. In some cases those tracing of the cross sectional solid area in each layer is the most time consuming process, it is possible to reduce the cross section by hollowing out the model and then making from this new part the STL file [1,5,6] . Lioa et al. [2] used usual STL file (not colored) for slicing with uniform thickness and they discussed about positive tolerance that is used in industrial mock ups and investment casting and also negative tolerance that is used in certain industrial applications such as cores used in producing cavity [2] . Another kind of STL file is color STL format that is used in colored model. Surface colored models are those colored only on their surfaces, such as the models used for assembly inspections, building models and jewelry models. Color STL format is derived from STL format, where triangular facets are used to approximate the geometry of a model and each facet is further assigned a color to indicate the color of the surface region approximated by the facet [3] . Because of uniform thickness of slicing the part may have some dismissed in geometry and also adaptive slicing increases process time. Direct and adaptive slicing are describe in the following: Direct slicing: Direct slicing uses the original CAD model as an input data, which is more accurate than STL file. It eliminates the limitations of STL and also avoids tessellation error and data repair associated with the use of an STL model [5] . Some limitations of slicing using STL format are described in [8,10] . In this method usually are used Visual Basic or Visual C++ to program for a special CAD/CAM software with its macro commands and then after deriving cross section they can reach to contour and section data by getting G codes of them [5] . In contrast of advantages of this method that eliminates the compensation of STL file, volume error in STL file, modifying and repairing STL format, this method is only used in specific software so cannot be used in others, but STL file is a standard format.
Adaptive slicing: Because of the curvature of surfaces of a CAD model, if one use uniform thickness in slicing, missing accurate geometry is inevitable. According to curvature it is more accurate to slice a CAD model by different layer thickness. In the literature, different approaches are used for this goal. For example surface normal, peak features and using NURBS-based CAD surface model for estimating layer thickness in a specific zone of a CAD model, are applied [7,9] . But all of them increase the number of layers so increase the RP process time, so in this research the efficient algorithms for slicing are developed that balance between accuracy and process time.
Hardware: In the Stereolithography (SL) process, a light beam is used to scan the surface of the photopolymer according to the sliced data and solidify a thin layer. Most machines use a UV laser beam to solidify the photo-polymer. He-C, argon or semi-conductor exited laser are popular UV laser sources used in SL process. There are several commercialized SL systems which could also use visible-light laser as the light source. Since the Argon laser cannot be turned on and off frequently, the laser beam must be switched on and off by some equipment such as shutter. However, the ordinary mechanical shutter speed is not high enough for scanning a laser beam. An Acoustic Optical Modulator (AOM) is used to control the switching of the beam. Higher positioning accuracy and higher scanning speed are, therefore, required for the galvanomirrors [1,4] as shown in Fig. 2. Fig. 2: Two galano-mirror mechanism for scanning [2] Fig. 3: Intersecting triangles with a plane A common apparatus has used two mirrors to reflect laser beam. In this study, a mirror for reflecting laser beam has been used to scan the cross section. This way simplifies the mechanism so that it easy to implement this mechanism to any applications that need laser scanning systems. A Visual Basic program for creating a user friendly interface is developed and consists of four modules that uses the developed slicing algorithms to control the mechanism.
Overview of slicing STL format algorithm: STL format is a collection of the triangles those approximate the surfaces of a CAD model. Each triangle is consist of three line segments, those represent with three points in 3D space. The mathematical representation of a line segment is: Which v(x),v(y),v(z) are respectively x, y and z components of v that is space vector between start point (x 1 ,y 1 ,z 1 ) and end point (x 2 ,y 2 ,z 2 ) of the line segment as shown in Fig. 3. If the triangle has a intersection with a specific z plane, generally it has two points from intersecting the edges of a triangle with that z plane, somehow in special case maybe we have only one point if the plane goes through vertex of the triangle. The flow chart of slicing algorithm is illustrated in Fig. 4.
At first in STL file, triangles that have a intersection with a specific z plane is found and then by intersecting these triangles, the intersection point are obtained. We get one of them as the starting point of one of the contours in that cross section, points chain must be finished at it. Then with another point we start again by searching adjacent triangle for the previous triangle and omit it in STL file and then procedure of intersecting and getting another point as the searching point, we go on, until the result of intersecting turn out the starting point, so the contour reaches to its end. This procedure is repeated for rest of triangles and the other contours are obtained until there was no triangle by having intersecting with that specific z plane. Each contour of each section is named by a code for next section. Then with incrementing z of the plane and using raw STL file without omission are created new contours of new cross section. Contour family of a section: For offset direction, inward or outward, contour family tree is necessary. For example in Fig. 5a, laser beam must be tangent inwardly to contour A and outwardly to contour B, so it is important to know which contour is inside another one. For this purpose as illustrated in Fig. 5a contours of each layer are intersected by the line that is parallel to x axis by starting from lower point (ymin) to higher y(ymax). By intersecting a specific line with all contours we can reach to a code that inherently shows the half-truth in this research. For example the code for line 1 is AEFFEA so as shown in Fig. 5b it is obvious to detect that contour F is inside E and E is inside A. By intersecting different line with contours, different codes are obtained, by comparing these codes together we can reach the main contour family tree of all contours in a cross section.

Estimating of layer thickness:
As we mentioned before, to have smooth surface, CAD model must be sliced with different layer thickness according to curvature of the surfaces. For an axis symmetric model, the layer thickness is determined by the angle between the normal vector and z-plane. When the angle is equal to 90°, the layer thickness can be as high as possible by the power of the laser and by the reducing the angle, the layer thickness is reduced proportionally. For an un axisymmetric model the average of those angles is used. The mid-perpendicular of each line that used for approximating a circle has unique intersection that is the center of that circle as shown in Fig. 7.

A prototype apparatus based on developed algorithms and mechanism:
The apparatus is used only one mirror to reflect the laser beam, the mechanism is illustrated in Fig. 8. A plane can be fixed by indicating two angles θ and β. Derivation θ and β equations respect to (x(t),y(t)) of a point that laser must be reflected to and differentiating them respect to time, the behaviors of axis rotation can be determined. The equations of θ, β, x(t) y(t) a y(t) , a y(t) x(t) x(t) y(t) a y(t) x(t) y(t) a x(t) y(t) a arctan 2  2  2  2  2  2  2  2  2  2  2  2  2 2 2 x(t) 1 y(t) a arccos(a / 2 x(t) y(t) a 4(x(t) y(t) a ) 2 4(x(t) y(t) a ) 2 x(t) y(t) a

MATERIALS AND METHODS
A prototype software has been developed based on mentioned algorithms in a VB interface as shown in Fig. 11. This program has an input for STL format and after computing mathematical operations for each section, sends data such as delays for stepper motors and the numbers of steps of them by a serial port to a AVR microcontroller (master microcontroller) and then master sends the data to another AVR microcontroller (slave), each of the microcontrollers (AVR 8535) handles just its stepper motor (accuracy = 1.5°/step and input voltage = 12 v), so it is caused to a smooth laser beam path. So after those by starting rotation of both stepper motors simulation of real laser beam started in a window in top and isometric view. In this program it is predicted some bottoms for jog movement and simulating this kind of movement in a separated window.

RESULTS AND DISCUSSION
For example for path of (0,0)-(100,100 mm) on x-y plane, angles and rotary speed are showed in Fig. 9.
The laser path speed is limited due to use of stepper motor for axis rotations. Note that all the diagrams for each path in x-y plane are different and have non-linear natures.

Different methods of laser beam path:
Linear rotation: This kind of method assumes that rotation velocities of both axes are linear and both of them must be started and finished at the same time. ∆θ and ∆β between two points (P 1 and P 2 ), in x-y plane must be completed in the time of laser beam path from P 1 -P 2 . So both of the axes have different angular velocities that must be created by delays of stepper motors. This method has low computation task for estimation, but the accuracy of path is limited.

Non-linear rotation:
The nature of rotations are nonlinear, so by discretion the path and approximating that with some linear limits and using Eq. 2 and 4, the tool path is made near to real laser path.
Modified non-linear rotation: Because of discretion the path laser beam starts at P 1 (Fig. 10), uses slop of P 1 -P 2 and when laser reaches to Pd 1 (point which is reached due to discretion) instead of using previous slop, software uses slop of Pd 1 to P 2 . So this method is repeated until the discretions are fined.

CONCLUSION
In this study a new efficient algorithm is developed for part slicing from STL file. Some algorithms for modifying the laser beam path are also developed such as: Derivation of contours in each layer, generate contour family tree, detective arcs and modifying laser beam path. These algorithms are implemented on Widows platform in a Visual Basic interface. A prototype SLA machine is developed based on using only one mirror, the advantages of this mechanism are its simplicity to implement in any processes that need laser scanning system.