• No se han encontrado resultados

8. APPENDIX

8.1 Introducción en castellano

This section explores the two methods that are used to generate G-Code for the lathe-type 3D printer. The first method consists in using Cartesian slicing software to generate the G-Code. A custom MATLAB was written to overcome the limitations of this method.

V.2.1 SLIC3R GCODE GENERATION

The current platform used to create print files for the standard Mendel max 3D printer can be made use of in cylindrical coordinate printing by “unwrapping” the part to be printed, the only difference being the replacement of the Y-axis with the Ɵ-axis. The unwrapped part does not resemble the final printout, but takes on its proper form as it is printed onto the cylindrical surface.

The software treats the cylindrical printer as it would the standard Cartesian printer, with the X, Y and Z axis mapping onto the Z, Ɵ and R respectively. The part to be sent to the printer is modelled as if it were flat, ensuring the Y-axis base measurement corresponds to the circumference of the print bed being used.

This method has an advantage of being fairly simple and quick, requiring no further programming or coding to achieve cylindrically printed parts. However, the disadvantages include limited complexity and dimensional accuracy as the part has to be unwrapped manually, leading to small geometrical discrepancies. This method also introduces a weakness in the form of a weld line that runs down the length of the printed part due to the discontinuity of the unwrapped part. The edge where the two opposite ends of the unwrapped part meet usually becomes the weakest part of the structure, overriding the advantage of cylindrical printing having interweaving filaments.

This can be overcome by unwrapping the part helically, but as a result requires much more complex modelling. At this point, writing automatic slicing software becomes more practical.

Figure 56: An unwrapped model and the resulting printout

Figure 57: Helical and Flat Unwrapping Helical Unwrapping

Flat Unwrapping

Weld Line

42

Figure 59: Main building blocks of the MATLAB GCode Generator

V.2.2 MATLAB GCODE GENERATION

A custom MATLAB program was created as an alternative method to create G-Code. The main aim of this initiative was to see whether some of the errors caused by using the SLic3r method outlined above could be mitigated.

The main appeal of the MATLAB method is that the angular velocity of the print bed can be updated at each layer. Unlike the Slic3r method, this can be used to ensure that as the number of layers increases, enough material is deposited to match the increasingly large surface which must be covered.

Another important benefit of the MATLAB code is that it can be used to produce interweaving.

Instead of depositing material as a series of adjacent rings, each layer can be printed helically as one continuous filament, as shown in figure 58. If the direction of the helix is reversed at each layer, the tensile properties in the axial direction and the surface finish could be enhanced.

The program is constructed as three functional blocks, represented in figure 59. The output is a list of GCode commands which is displayed in the MATLAB window.

The first step is initialisation, in which user-defined parameters such as print bed diameter and filament thickness are defined. The second step consists of the generation of setup instructions which must be sent before the part can start printing. Once these steps have been completed, the actual G-Code printing instructions are generated from the parameters set in section 1. Steps 1 and 3 are then repeated for every layer to generate the GCode.

Figure 58: A single layer printed as adjacent rings (left) and as a continuous helix (right)

43

Step 1: Initialisation

The first functional block of the MATLAB program is shown in figure 60. Two parameters required to initialise the print are the filament width and the print bed diameter (lines 4 and 5). The number of full rotations of the print bed necessary to print a layer is denoted as ‘NL’ (line 9). This number is obtained by dividing the length of the current layer by the filament width.

The starting position for the print head is initialised in the axial, rotational and vertical directions with variables ‘x’, ‘y’ and ‘z’ respectively (lines 10-15). Vertical position ‘z’ is initially set as the filament width so that the extruded material can be deposited. Finally, the extrusion coordinates (line 15) and the iteration counter ‘i’ (line 11) are initialised.

Figure 60: Step 1 of the code: setting the relevant parameters

Step 2: Setup

The function of this part of the program is to setup the printer before the printing can start. Unlike the other functional blocks which are iterated, this step is carried out only once. Comments are inserted in the G-Code commands preceded by a semicolon.

The print head’s position is sent to the origin for the X and Z axes (line 19) and verified using the endstops. The Y axis (rotation) does not need to be homed, as the initial angle of the print bed is irrelevant. The nozzle temperature is set to 190°C and is maintained throughout the printing process (line 20). The commands G90 and G21 (line 21) imposes the use of absolute coordinates throughout the entire printing process, and sets the units to millimetres.

Figure 61: Step 2 of the code: sending the setup up commands to the printer

44

Step 3: Generating printing instructions

Once the printer is ready, the printing instructions can be loaded. The first command in step 3 is to set the feed rate (line 30). The value “50*p” was determined from trial and error.

The continuous printing instructions are generated through a while loop (lines 31 to 38). As long as the counter ‘i’ is inferior to or equal to the number of lines required to print the layer, the while loop is enabled. The counter ‘i’ is updated in the loop by adding 1 every time the loop is repeated (line 36). The counter ‘i’ represents the number of rotations the print bed has undergone on the current layer. It is compared to the total number of rotations that are necessary for the layer.

The printing instructions are generated through a long string (lines 32 and 33). The values of x, y, z and e are updated every loop in the required GCode format. The “strcat” function concatenates the elements into a unique string. G1 is the GCode function for a controlled move from the current location to the defined location. The translation is done in a straight line while the nozzle extrudes.

Figure 62: Step 3 of the code: generating the printing instructions

Once the layer is finished, the above steps are repeated for each subsequent layer.

Output

Once run, the MATLAB program generates the code displayed in figure 63. The code is very long, so only the beginning of it is shown. The structure of the remaining part of the code is identical to what is displayed in the figure.

Figure 63: The generated G-Code by the MATLAB program. Only the beginning of the code is shown

Setup commands

(step 2)

Printing commands

(step 3)

45

The printed part

A picture of the printed part using the GCode produced with MATLAB is shown in figure 64.

Documento similar