3D Printing – behind the screen
We design something digging into the depths of our imagination, feed into some flashy software and obtain stunning prints. But how much are we aware of what is going on behind these processes? Let’s explore the behind the screen processes of 3D printing.
As already known, the first step of any 3D printing process begins with designing a part in a computer aided design (CAD) software. The figure below shows the sequence to be followed. There are three major types of 3D CAD models. Though we are not much concerned about the algorithm behind these models, it is useful just to know the types, as it may come handy when dealing with design errors.
Wireframe model: The object is visualised as a set of edges or corner points in a wireframe model. It is simple in construction, but does not contain any information about surface or volume of the object. Misinterpretation of the object is also possible because of absence of opaque surfaces.
Surface model: In a surface model, as the name suggests the object is visualised as a set of surfaces. Here visible and hidden edges can be differentiated but volume information cannot be obtained.
Volume model: The actual presence of material is visualised through volume model. The intent of designer can be directly modelled as a volumetric object. Volumetric models are further divided into three more categories, constructive solid geometry, boundary representation model and hybrid model. They differ in terms of mode of construction, but the output functionalities are more or less the same.
Almost all the CAD software today are intelligent enough to combine all of these features optimally to provide good quality design and low data volume. Once we design the model to be built, we will need to slice it as the next step of 3D printing process. This subsequent process needs to be compatible with the file format output of CAD. As in any other sector, each design software provider also maintains its own data format. Hence an interface was developed, which is a set of rules, conventions and conditions, and defines the information exchange between two entities. In simple words, the CAD file which was created has to be converted into an interface format to process it with another software. IGES, STEP, VDAFS, DXF and STL are some popular interfaces used in CAD data processing.
STL is the interface which is widely used by the 3D printing community, so we will explore a bit of what happens in this data format. Once the CAD modelling is completed, we save it in STL format. STL stands for Standard Tessellation Language, though STereoLithography or Standard Triangle Language is also sometimes used. The entire 3D model is made to represent as connected triangles in this format. Each triangle is represented by its coordinates of edges and surface normal vector (a direction perpendicular to the surface of the triangle). The quality of the part is determined by these triangles. Higher the density of triangular meshing, higher will be the part quality, but resulting in higher data volume as well.
Behind the screen, these STL files specify ASCII and binary representations to be processed by microprocessors or microcontrollers. Binary files are most common as tend to be lighter. A binary STL has the information showing the title for the file, the number of facets, the three vertices of the triangle and the normal vector. A simplified explanation of the syntax is shown below.
Line 1: Header – Title of file
Line 2: Number of triangles
Now for each triangle in the file,
Line 3: Normal vector (specified in terms of I,j,k vectors)
Line 4: X,Y,Z coordinates for vertex 1
Line 5: X,Y,Z coordinates for vertex 2
Line 6: X,Y,Z coordinates for vertex 3
Line 7: Attribute byte count
Lines 3 to 7 are repeated for the total number of triangles present in the STL file. This means that by utilising the proper syntax, the entire CAD model can be written as codes and processed without using a CAD software (though it may make you look a bit geeky).
So now we have created our 3D CAD model and converted into STL format. Note that STL is only an interface format to enable communication between entities. The next step is to convert this file into a language which is understood by the stepper motors in our 3D printer. Moreover 3D printing is a layer by layer manufacturing process. So the generated STL file is to be arranged as geometries stacked in the vertical direction. This process is termed as slicing.
A number of software are available for slicing as well. They slice the model into horizontal layers and formulate the path of tool to trace these layers. The STL file generated from previous step is provided as input to the slicing software, and output is obtained in terms of gcode. Gcode is the language which is to be fed to the microcontroller which controls the machine. Each line in a gcode program consists of information about the sequence of operations in the form of pre-defined codes. A small glimpse of an example gcode file is shown below.
M190 S60 ; set bed temperature
M104 S200 ; set temperature
G28 ; home all axes
M109 S200 ; wait for temperature to be reached
G90 ; use absolute coordinates
G21 ; set units to millimeters
G92 E0 ; reset extrusion distance
M82 ; use absolute distances for extrusion
G1 Z0.300 F7800.000
G1 X54.010 Y59.690
G1 F1800.000 E1.00000
G1 X54.190 Y59.510 F540.000 E1.00707
M104 S0 ; turn off temperature
G28 X0 ; home X axis
M84 ; disable motors
The above program has pre-defined keywords such as M190, S60, etc. Each of these keywords has respective meanings understood by the microcontroller. It also means that you can program the entire gcode file and feed to the 3D printer’s microcontroller without needing any CAD/STL file (you can imagine the level of geekiness).
Once this gcode program is fed into the 3D printer, its microcontroller understands the keywords, reads the values, and provides appropriate voltage signals as output. How the microcontroller converts computer code into electrical voltages is a subject of micro-level operations involving Boolean logic, nevertheless, it is quite sufficient to realise that you can alter the voltage signals by editing the gcode data. These voltage signals are fed to the stepper motors, extruder, heating element and other electrical items in the printer. Thus the table moves, filament gets heated, extruder moves by timed modulation of these signals; and your designed model gets printed in front of your eyes!
It is always beneficial to monitor the output of various processing steps, it helps in troubleshooting too. So ready to type your own gcode program and build your part? Why not give a try?