0% found this document useful (0 votes)
14 views

Admin, Vorisek

The document discusses preprocessing 3D printer input files for numerical simulation of the additive manufacturing process. It presents a concept to process native 3D printer input files (G-code format) to create a spatial finite element mesh suitable for simulating the printing process. The preprocessing calculates the position of the printer head and deposited material volume over time by evaluating each G-code command as the printer firmware would. A discrete voxel model with variable edge lengths and time discretization represents the computational model. The volume of deposited material is calculated for each voxel as a function of time, resulting in a model suitable for numerical analysis of the printing process.

Uploaded by

Hari Merdic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Admin, Vorisek

The document discusses preprocessing 3D printer input files for numerical simulation of the additive manufacturing process. It presents a concept to process native 3D printer input files (G-code format) to create a spatial finite element mesh suitable for simulating the printing process. The preprocessing calculates the position of the printer head and deposited material volume over time by evaluating each G-code command as the printer firmware would. A discrete voxel model with variable edge lengths and time discretization represents the computational model. The volume of deposited material is calculated for each voxel as a function of time, resulting in a model suitable for numerical analysis of the printing process.

Uploaded by

Hari Merdic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Acta Polytechnica CTU Proceedings 26:144–148, 2020 © Czech Technical University in Prague, 2020

doi:10.14311/APP.2020.26.0144 available online at https://ojs.cvut.cz/ojs/index.php/app

PRE-PROCESSING OF ADDITIVE MANUFACTURING INPUT


FILES FOR NUMERICAL SIMULATION

Jan Voříšek∗ , Bořek Patzák


Czech Technical University in Prague, Faculty of Civil Engineering, Department of Mechanics, Thákurova 7,
166 29 Prague 6, Czech Republic

corresponding author: [email protected]

Abstract. In this contribution, we present the concept of a 3D printer software emulator facilitating
the creation of a spatial finite element mesh suitable for the printing process simulation.
The concept is based on gradual processing of a native 3D printer input file (in a G-code format).
This file contains a complete description of manufacturing process consisting of series of individual
commands interpreted by a printer. The effect of each command needs to be precisely evaluated to
obtain the position of the printer head and the volume of the deposited material in any given time.
The calculation is performed in the same way as in the Marlin printer firmware using the trapezoidal
motion curves and a command buffer. To represent a computational model, a discrete voxel model with
variable edge length and time discretization is used. The volume of deposited material is calculated for
each voxel as a function of time. The resulting model is suitable for numerical analysis of the printing
process.
Keywords: Additive manufacturing, 3D printing, 3D printer emulator.

1. Introduction
Additive manufacturing emerged as an innovative man-
ufacturing process in the field of rapid prototyping.
It is based on incremental deposition or sintering of
the material in thin layers. Wide range of materials,
including plastic, metal or even concrete, can be used
to produce spatial objects of complex geometries and
shapes (see Figure 1). The objects can be designed
using currently available CAD software.
Printing a prototype is often more affordable than
making one by hand, and certainly less costly than
contracting a manufacturer to do it by conventional Figure 1. Visualization of the geometry of a printed
manufacturing, especially in the fields where low quan- object in CAD.
tities of parts with a high degree of customization
and complexity play the critical role. An extensive
overview of the additive manufacturing methods is
available in [1].
Additive manufacturing consists of several indepen-
dent sub-processes. Everything begins with a 3D
model which, in order to be printed, must be pro-
cessed using specialised software called slicer. The
slicing process produces a sequence of commands to
control the movement and operation of the machine
stored in a G-code file line by line. This file describes
the complete processing (it is directly interpreted by
the printer) and is used as an input for the presented
pre-processing tool. Visualization of the movement
commands can be seen in Figure 2 and Figure 4.
In recent years, there has been an increasing inter- Figure 2. Visualization of the movement commands
contained in the input file (single layer). Moves with
est in the simulation of the additive manufacturing
material extrusion are drawn with blue color, moves
process. Parts produced primarily with extrusion of without extrusion with black color.
molten thermoplastics often do not reach designed di-
mensions due to the cracking and warping induced by
large temperature gradients [2, 3]. Such issues are also

144
vol. 26/2020 Pre-processing of Additive Manufacturing Input Files

present in conventional manufacturing processes like particularly of printer head moves. This step is per-
injection moulding where accurate numerical simula- formed only once and results can be reused to generate
tion allows to mitigate such issues by optimising the simulation inputs with different resolution.
object geometry or the production process itself [4].
Numerical simulation of the manufacturing process 3.1. Duration of moves
is indispensable to produce tailored, defect-free and It is essential to capture the real printing speed in
optimised products. Due to the complexity of the pro- the sequence of point-to-point moves. The target
cess, the coupled transient thermo-mechanical analysis printer speed is defined in the G-code file for each
is needed for reliable predictions. Some research of the move, yet the actual motion profile is to be decided
additive manufacturing has been already conducted by the individual printer.
using the Finite Difference Method [3]. Constant acceleration is the most used planning
In this contribution we assume that the Finite Ele- strategy resulting in a trapezoidal velocity profile due
ment Method (FEM) will be used to solve the problem. to its mathematical simplicity and limited computing
Our goal is to develop a software tool able to auto- power of the 3D printers microprocessors. The printer
matically prepare inputs for the FEM model (domain stores a limited number of moves, usually 16, in a
discretization, boundary conditions, etc.) straight buffer and recalculates the acceleration profile allowing
from the additive manufacturing input files. Not only the printer to be able to stop after the last move, if
should our tool generate a suitable 3D mesh, but it needed. The typical printing speed of one print layer
should also provide the history of the infill percentage can be observed in Figure 3.
of the single mesh elements. By knowing the infill Maximal accelerations and velocities must be re-
percentage, we will be able to consider the two-phase spected in the direction of each axis. These limits
characteristics of the voxels (thermoplastics and air). can be taken from the 3D printer specification or the
The process is, in a sense, an inverse process of slicing source code of the printer controller firmware (Marlin,
as it produces the simplified (voxelized) version of the RepRap).
original object. Duration of the movements can be determined us-
ing the calculated velocity and known distance. By
Several G-code processing utilities are available on-
gradually summing up the duration of individual com-
line [5, 6]. These tools provide print time estima-
mands, we can obtain the current time for any given
tion and filament consumption. However, they only
print head position. This information is essential for
consider the printer moves as vectors, and thus con-
numerical simulation as we can reverse this procedure
structing the voxel model with the material extrusion
to calculate the position of the print head for any
history is not possible. Our solution extends the idea
given time (time step).
of the movement commands into the 3D space consid-
ering each of them as a block of material with a finite
volume.

2. The model
Finite element model can generally consist of elements
of various shapes. We have chosen a discrete voxel
model with variable edge length along each axis due
to its simplicity.
Assuming all the edge lengths equal leaves us with
a simple cube. This simplification will allow the pre-
computation of shape function values and their deriva-
tives as they are same for all the elements. On top of Figure 3. Visualization of the printer head speed
that, such a hexahedral element is commonly used in during processing of a single layer assuming the trape-
the FEM software packages. zoidal velocity profile.

3. G-code pre-processing 3.2. Reconstructing the extrusion


The first step into the simulation of additive manu- width
facturing is to pre-process the raw input files. These Extrusion width is essential for calculating the inter-
files contain a line-separated set of instructions for section of the extrusion volume and the individual
the 3D printer to follow. A complete overview of all voxels to determine the amount of material deposition
the available G-codes is available online [7]. Only inside each voxel. It is difficult to define the exact
a small subset of the commands, which controls the shape of the extrusion cross-section. Therefore slicers
deposition of the material, is considered. use various simplified shapes for their internal calcu-
Processing of the printer input file begins with de- lations, most notably a rectangle with curved sides
termining the duration of individual commands and (Fig. 6) or a simple rectangle [8].

145
Jan Voříšek, Bořek Patzák Acta Polytechnica CTU Proceedings

Figure 6. Extrusion width geometry used to produce


G-code in Slic3r software [8]
Figure 4. G-code visualization of the first layer of a
20 × 20 × 20 mm cube.

πD2
wi = ∆E (3)
4hi Li

The simplified calculation produces a slightly nar-


rower extrusion width than the original Slic3r value
assuming oval-shaped sides of the cross-section. The
difference is negligible and will be not be taken into ac-
count in any further calculations. For slicers assuming
rectangular extrusion cross-sections, the calculated
width will match the original value.
Extrusion width calculation can be omitted for addi-
tive manufacturing processes based on the laser beam
sintering of material such as Stereolitography. In such
case the width is defined by the beam diameter.
Figure 5. Activated voxel elements of a first layer of
a 20×20×20 mm cube including volume assignment.
4. Voxel activation and filling
The voxel-activation and the extruded volume assign-
Extrusion volume shape is automatically set in the
ment is performed for each combination of time-step
slicing software based on the nozzle diameter or man-
length and voxel-size. See Figure 5 for an example of
ually input by the user. However, the information
a single processed print layer.
is not present in the exported G-code file, and so
it must be recalculated using known variables. To
make the calculation slicer-independent, we assume a 4.1. The principle
rectangular cross-section of the deposition. Single depositions, represented by block geometry, are
The extruded volume can be calculated as to be decomposed (projected) into the individual voxel
contributions. Calculating the intersection of two
generally oriented blocks would be very computation-
Vin = wi hi Li (1) heavy. Fortunately, the deposition of the material
occurs in horizontal planes, and so the intersection
where wi is extrusion width, hi is extrusion volume can be decomposed into two much simpler processes.
height and Li is extrusion volume length (see Figure 6). The first process is the so called horizontal decom-
It must be equal to the volume of material coming position, where extrusion volume (represented as arbi-
into the extruder given as trarily oriented rectangle is decomposed to individual
voxel column contributions (rasterization).
πD2 In the second step (vertical decomposition), the
Vin = ∆E (2) extruded volume is distributed to individual voxels
4
in a column according to the height and position of
where D is nozzle diameter and ∆E is length of extruded material volume.
extruded material. These two subprocesses together provide history of
The unknown extrusion width is then expressed as extruded material volume in each voxel.

146
vol. 26/2020 Pre-processing of Additive Manufacturing Input Files

Figure 7. Activation sequence of the individual voxel elements. The colour of each voxel corresponds to its infill
percentage (VOF). The centre of the print consists mostly of filled elements shown in red colour while blue elements
near the surface of the printed part are almost empty.

4.2. Optimization 5. Conclusions


The bounding box of the depositions is calculated to Prototype G-Code pre-processor and voxel-model gen-
save computer resources, so only the voxels contained erator were implemented in JavaScript based on the
within the bounding box are considered for the inter- previously formulated methodology. Several real-
section calculation. Furthermore, it is possible to use world files were processed using the tool. Example of
Bresenham’s line algorithm to only mark the affected complex geometry can be seen in Figure 7.
voxels by doing only integer math. So far, it appears that it is possible to create voxel-
based geometry. The developed tool enables to observe
4.3. Issues the time sequence of element activation immediately
after the input file analysis. For example the model
Some issues emerged after implementing the above- in the Figure 7 was processed on a generic consumer
described process. Slicers usually produce overlapping laptop in one thread using a 1 × 1 × 1 m voxel grid in
extrusions (see Figure 8) to improve the bonding of 2.6 seconds.
the parallel extrusions. The resulting infill history It is desirable to perform 3D numerical analysis of
contained over-filled voxels (volume over 100%). The the additive manufacturing process using the knowl-
issue is also caused by considering the depositions edge of element activation sequence and the VOF
as non-continuous (see Figure 9). The second issue distribution over time.
can be eliminated by considering the intersection of
successive depositions. The overlapping volume is 6. Future work
rotated by 180 degrees and moved into the affected
voxels as can be seen in Figure 9. Our main goal is to create a robust, user-friendly tool
for the numerical analysis of additive manufacturing
and its optimization. The tool should be able to take
the G-code input file, process it to obtain mesh with
element infill history and finally, run FEM analysis
and post-process the results. This paper solves the pre-
processing part as the first step in an overall complex
Figure 8. Overlap of the two concurrent depositions process.
(overlapping volume marked with red). For proper numerical simulation, it is desired to
identify the thermal, mechanical, as well as process-
related properties of the materials involved. We foresee
the formulation of suitable constitutive material mod-
els and development of suitable adaptive FE solver.
Furthermore, we also expect to conduct lab-scale mea-
surements to determine constitutive parameters and
develop and calibrate suitable material models.
The idea of gradual voxel activation could be ex-
Figure 9. Overlap of the two non-straight deposi- tended from to the activation of generally shaped ele-
tions (overlapping volume marked with red). The red ments of a finite element mesh. The elements generally
volume must be redistributed into the green area. do not need to form any regular grid. Therefore current
advanced mesh generators could be used to discretize
The voxel volume is checked after each volume differ- printed object. Such elements can be gradually ac-
ence assignment, and the surplus volume (over 100%; tivated and filled in a same principle as the voxels.
if applicable) is redistributed into the eight horizontal However, we expect the intersection of the extrusion
neighbouring elements to keep the maximum volume block and a general element to be very computationally
of each voxel at 100%. expensive.

147
Jan Voříšek, Bořek Patzák Acta Polytechnica CTU Proceedings

Acknowledgements [4] R. Johansson, D. Konijnendijk. INJECTION


The financial support of this research by the Grant Agency MOULDING SIMULATION — A finite element
of the Czech Technical University in Prague (SGS project approach to analyse thethermodynamics in an IM tool.
No. SGS19/032/OHK1/1T/11) is gratefully acknowl- Master’s thesis, Queensland University of Technology,
edged. 2007.
[5] A. Ustyantsev. gcodevisualizer - a web-based visual
References gcode viewer and analyzer.
[1] H. Bikas, P. Stavropoulos, G. Chryssolouris. Additive https://github.com/hudbrog/gCodeViewer. Accessed:
manufacturing methods and modelling approaches: a 2019-07-11.
critical review. The International Journal of Advanced [6] gcodeanalyser.com. G-code analyser.
Manufacturing Technology 83(1-4):389–405, 2015. http://www.gcodeanalyser.com/. Accessed:
doi:10.1007/s00170-015-7576-2. 2019-07-11.
[2] Y. Zhang, K. Chou. A parametric study of part [7] RepRap. G-code — reprap.
distortions in fused deposition modelling using https://reprap.org/wiki/G-code. Accessed:
three-dimensional finite element analysis. Proceedings of 2019-07-10.
the Institution of Mechanical Engineers, Part B:
Journal of Engineering Manufacture 222(8):959–968, [8] G. Hodgson, A. Ranellucci, J. Moe. Slic3r manual —
2008. doi:10.1243/09544054jem990. flow math.
https://manual.slic3r.org/advanced/flow-math.
[3] T. Stockman, J. A. Schneider, B. Walker, J. S. Accessed: 2019-07-15.
Carpenter. A 3d finite difference thermal model tailored
for additive manufacturing. JOM 71(3):1117–1126,
2019. doi:10.1007/s11837-019-03338-6.

148

You might also like