## 3 Integrated User-Oriented Framework
### Cloud Service: CAM and Materials Management  
The Cloud Service arises from the need to avoid the end-user handling the tools and configurations needed to print, such as 3D model slicing or G-code building. Furthermore, the use of recycled materials increases the complexity of the correct G-code generation, as it is necessary to manipulate parameters such as speed, cooling, manufacturing temperatures, extruder retractions and so on, which are dependent on the properties of the filament. The proposed Cloud Service works as a REST API and fulfils a dual purpose:  
* to provide the tools for automatic and customised G-code generation;
* to serve as a link to the material database where the stock at the user nodes and the properties of standard and recycled filaments are stored. All this information is intended to help in material selection, detailed in Section 3.3.1.  
The CAM service chosen for the proposed architecture from the open slicing software available is PrusaSlicer. This slicing software makes it possible to perform operations via the Command Line Interface (CLI) in addition to the graphical interface, thus enabling automation of machine code generation.  
The main process that the CAM or slicing software performs in the proposed architecture is as follows. The slicer generates the machine toolpaths from two elements: manufacturing specifications, contained in a single file, and the 3D model of the part in STL format. Manufacturing specifications are composed of key-value data and can refer to three different entities:  
* 3D printer configuration, related to the machine: nozzle diameter, accelerations, print volume, etc.;
* filament configuration, related to material: hot-end and hot-bed temperature, cooling settings, etc.;  
Figure 2: Local service constitution and link to end-user app.  
* quality profile configuration, related to the process: layer height, top and bottom solid layers, wall thickness, etc.  
Each entity has different values related to its possible configurations. These three entities have a many-to-many relationship, as a printer can use multiple filaments and multiple quality profiles in the same way that one filament supports multiple printers and multiple quality profiles. In the proposed architecture, a good adjustment of the filament configuration between the three described entities becomes important, as it depends on the properties of the new materials obtained.  
The maintainability of the filament configuration lies in updating the specific bundle of materials and adding new recycled ones with different values in their properties, not in the specific knowledge of the user in additive manufacturing. Therefore, the proposed Cloud Services provide automatic adaptation of the process to the material.  
The IDEF0 diagram in Figure 3 shows the main activities of the process for the G-code generation.  
The Cloud Service is essentially composed of two parts: the configuration core (configuration file creation process) and the slicing core (CAM process). In activity A1.1, the selected parameters (printer, filament and quality) are searched for in the configuration bundles to compile them (\"configuration core\" in Figure 3) into a single file. Both files, configuration and STL, are used by the \"slicing core\" to generate the motion code (G-code file in Figure 3) when it receives the start command.  
On the other hand, the customer can request information on materials to know their availability and properties. This data is supplied by the Cloud Service to the end-user application. Furthermore, the printing qualities that contain the qualities available for the manufacture of the final part can also be requested.  
The service provider is responsible for keeping the material information up-to-date as new filaments become available and adjusting the filament configuration properties for the slicing process accordingly.