Manual:Preparing models for 3D printing/pl

Jednym z głównych zastosowań programu FreeCAD jest produkcja rzeczywistych obiektów. Mogą one być zaprojektowane w FreeCAD, a następnie urzeczywistnione na różne sposoby, takie jak przekazanie ich innym ludziom, którzy następnie je zbudują, lub, coraz częściej, przesłanie ich bezpośrednio do drukarki 3D lub frezarki CNC. W tym rozdziale dowiesz się, jak przygotować swoje modele do przesłania do tych maszyn.

Jeśli byłeś ostrożny podczas modelowania, większość trudności, które możesz napotkać podczas drukowania modelu w 3D została już uniknięta. Wiąże się to w zasadzie z:


 * Upewnieniem się, że twoje obiekty 3D są bryłowe. Obiekty świata rzeczywistego są bryłami, model 3D również musi być bryłą. We wcześniejszych rozdziałach widzieliśmy, że FreeCAD bardzo pomaga w tej kwestii, a środowisko pracy Projekt Części powiadomi Cię, jeśli wykonasz operację, która uniemożliwi zachowanie bryły modelu. Moduł Część zawiera również narzędzie [[Image:Part_CheckGeometry.svg|16px]] Sprawdź geometrię, które jest przydatne do dalszego sprawdzania występowania możliwych wad.
 * Upewnij się co do wymiarów swoich obiektów. Jeden milimetr będzie jednym milimetrem w prawdziwym życiu. Każdy wymiar ma znaczenie.
 * Kontrolowanie degradacji. Żaden system druku 3D lub frezowania CNC nie może przyjmować plików FreeCAD bezpośrednio. Większość z nich rozumie tylko język maszynowy zwany G-Code. G-kod ma dziesiątki różnych dialektów, każda maszyna lub sprzedawca zazwyczaj ma swój własny. Konwersja twoich modeli do G-Code może być łatwa i automatyczna, ale możesz też zrobić to ręcznie, z pełną kontrolą nad wynikiem. W każdym przypadku, nie można uniknąć utraty jakości modelu podczas tego procesu. Podczas drukowania w 3D, musisz zawsze upewnić się, że ta utrata jakości pozostaje poniżej Twoich minimalnych wymagań.

Poniżej założymy, że pierwsze dwa kryteria są spełnione i że jesteś już w stanie tworzyć obiekty bryłowe o prawidłowych wymiarach. Zobaczymy teraz, jak rozwiązać trzeci punkt.

Eksport do krajalnicy
Jest to technika najczęściej stosowana w druku 3D. Obiekt 3D jest eksportowany do innego programu (slicera), który wygeneruje G-kod z obiektu, poprzez pocięcie go na cienkie warstwy (stąd nazwa), które będą odtwarzać ruchy, jakie wykona drukarka 3D. Ponieważ wiele z tych drukarek jest budowanych domowym sposobem, często występują niewielkie różnice pomiędzy nimi. Programy te zazwyczaj oferują zaawansowane możliwości konfiguracyjne, które pozwalają na dostosowanie wydruku dokładnie do możliwości Twojej drukarki 3D.

Actual 3D printing, however, is too vast a subject for this manual. But we will see how to export and use these slicers to check that the output is correct.

Converting objects to meshes
None of the slicers will, at this time, directly take the solid geometry as we produce in FreeCAD. So we will need to convert any object we want to 3D print into a mesh first, that the slicer can open. Fortunately, as much as converting a mesh to a solid is a complicated operation, the contrary, converting a solid to a mesh, is very straightforward. All we need to be careful about, is that it is here that the degradation we mentioned above will occur. We need to check that the degradation stays within acceptable limits.

All the mesh handling, in FreeCAD, is done by another specific workbench, the Mesh Workbench. This workbench contains, in addition to the most important tools that convert between Part and Mesh objects, several utilities meant to analyze and repair meshes. Although working with meshes is not the focus of FreeCAD, when working with 3D modeling, you often need to deal with mesh objects, since their use is very widespread among other applications. This workbench allows you to handle them fully in FreeCAD.


 * Let's convert one of the objects we modelled in the previous chapters, such as the lego piece (which can be downloaded from the end of the previous chapter).
 * Open the FreeCAD file containing the lego piece.
 * Switch to the Mesh Workbench
 * Select the lego brick
 * Select menu Meshes → Create Mesh from Shape
 * A task panel will open with several options. Some additional meshing algorithms (Mefisto or Netgen) might not be available, depending on how your version of FreeCAD was compiled. The Standard meshing algorithm will always be present. It offers less possibilities than the two others, but is totally sufficient for small objects that fit into the maximum print size of a 3D printer.




 * Select the Standard mesher, and leave the deviation value to the default value of 0.10. Press Ok.
 * A mesh object will be created, exactly on top of our solid object. Either hide the solid, or move one of the objects aside, so you can compare both.
 * Change the View → Display Mode property of the new mesh object to Flat Lines, in order to see how the triangulation occurred.
 * If you are not happy, and think that the result is too coarse, you can repeat the operation, lowering the deviation value. In the example below, the left mesh used the default value of 0.10, while the right one uses 0.01:



In most cases, though, the default values will give a satisfying result.


 * We can now export our mesh to a mesh format, such as STL, which is currently the most widely used format in 3D printing, by using menu File → Export and choosing the STL file format.

If you don't own a 3D printer, it is usually very easy to find commercial services that will print and send you the printed objects by mail. Among the famous ones are Shapeways and Sculpteo, but you will usually find many others in your own city. In all major cities, you will nowadays find Fab labs, which are workshops equipped with a range of 3D manufacturing machines, almost always including at least one 3D printer. Fab labs are usually community spaces, that will let you use their machines, for a fee or for free depending on the Fab lab, but also teach you how to use them, and promote other activities around 3D manufacturing.

Using Slic3r
Slic3r is an application that converts STL objects into G-code that can be sent directly to 3D printers. Like FreeCAD, it is free, open source and runs on Windows, Mac OS and Linux. Correctly configuring things for 3D printing is a complicated process, where you must have a good knowledge of your 3D printer, so it is not very useful to generate G-code before actually going to print (your G-code file might not work well on another printer), but it is useful for us anyway, to check that our STL file will be printable without problems.

This is our exported STL file opened in Slic3r. By using the preview tab, and moving the right slider, we can visualize the path that the 3D printer head will follow to construct our object.



Using the Cura addon
Cura is another free and open source slicer application for Windows, Mac and Linux, maintained by the 3D printer maker Ultimaker. Some FreeCAD users have created a Cura Workbench that uses cura internally. The Cura Workbench is available from the FreeCAD addons repository. To use the Cura Workbench, you also need to install Cura itself, which is not included in the workbench.

Once you have installed both Cura and the Cura Workbench, you will be able to use it to produce the G-code file directly from Part objects, without the need to convert them to meshes, and without the need to open an external application. Producing another G-code file from our Lego brick, using the Cura Workbench this time, is done as follows:


 * Load the file containing our Lego brick (it can be downloaded at the end of the previous chapter)
 * Switch to the Cura Workbench
 * Setup the printer space by choosing menu 3D printing → Create a 3D printer definition. Since we aren't going to print for real, we can leave the settings as they are. The geometry of the printing bed and available space will be shown in the 3D view.
 * Move the Lego brick to a suitable location, such as the center of the printing bed. Remember that PartDesign objects cannot be moved directly, so you need either to move its very first sketch (the first rectangle), or to move (and print) a copy, which can be made with the Part -> Create Simple Copy tool. The copy can be moved, for example with [[Image:Draft_Move.svg|16px]] Draft → Move.
 * Select the object to be printed, and select menu 3D printing → Slice with Cura Engine.
 * In the task panel that will open, make sure the path to the Cura executable is correctly set. Since we are not going to really print, we can leave all other options as they are. Press Ok. Two files will be generated in the same directory as your FreeCAD file, an STL file and a G-code file.




 * The generated G-code can also be re-imported into FreeCAD (using the slic3r preprocessor) for checking.

Generating G-code
FreeCAD also offers more advanced ways to generate G-code directly. This is often much more complicated than using automatic tools as we saw above, but has the advantage to let you fully control the output. This is usually not needed when using 3D printers, but becomes very important when dealing with CNC milling, as the machines are much more complex.

G-code path generation in FreeCAD is done with the Path Workbench. It features tools that generate full machine paths and others that generate only parts of a G-code project, that can then be assembled to form a whole milling operation.

Generating CNC milling paths is another subject that is much too vast to fit in this manual, so we are going to show how to build a simple Path project, without caring much about most of the details of real CNC machining.


 * Load the file containing our lego piece, and switch to the Path Workbench.
 * Since the final piece doesn't contain anymore a rectangular top face, hide the final lego piece, and show the first cubic pad that we did, which has a rectangular top face.
 * Select the top face and press the [[Image:Path_Profile.svg|16px]] Profile button.
 * Set its Offset property to 1mm.




 * Then, let's duplicate this first loop a couple of times, so the tool will carve out the whole block. Select the Profile path, and press the [[Image:Path_Array.svg|16px]] Array button.
 * Set the Copies property of the array to 8, and its Offset to -2mm in the Z direction, and move the placement of the array by 2mm in the Z direction, so the cutting will start a bit above the pad, and include the height of the dots too.




 * Now we have defined a path that, when followed by the milling machine, will carve a rectangular volume out of a block of material. We now need to carve out the space between the dots, in order to reveal them. Hide the Pad, and show the final piece again, so we can select the face that lies between the dots.
 * Select the top face, and press the [[Image:Path_Pocket_Shape.svg|16px]] Pocket Shape button. Set the Offset property to 1mm, and the retraction height to 20mm. That is the height to where the cutter will travel when switching from one loop to another. Otherwise, the cutter might cut right through one of our dots:




 * Once again, make an array. Select the Pocket object, and press the [[Image:Path_Array.svg|16px]] Array button. Set the Copies number to 1 and the offset to -2mm in the Z direction. Move the placement of the array by 2mm in the Z direction. Our two operations are now done:




 * Now all that is left to do is to join these two operations into one. This can be done with a Path Compound or a Path Job. Since we will need nothing more and will be ready to export already, we will use the job. Press the [[Image:Path_Job.svg|16px]] Job button.
 * Set the Use Placements property of the project is to True, because we changed the placement of the arrays, and we want that to be taken into account in the project.
 * In the tree view, drag and drop the two arrays into the project. You can reorder the arrays inside the project if needed, by double-clicking it.
 * The project can now be exported to G-code, by selecting it, choosing menu File -> Export, selecting the G-code format, and in the pop-up dialog that will open, selecting a post-processing script according to your machine.

There are many applications available to simulate the real cutting, one of them that is also multi-platform and open source, like FreeCAD, is Camotics.

Downloads


 * The STL file generated in this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/lego.stl
 * The file generated during this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/path.FCStd
 * The G-code file generated in this exercise: https://github.com/yorikvanhavre/FreeCAD-manual/blob/master/files/lego.gcode

Read more


 * The Mesh Workbench
 * The STL file format
 * Slic3r
 * Cura
 * The Cura Workbench
 * The Path Workbench
 * Camotics