Macro 3D Printer Workflow

Description
This macro creates an stl file with perfect rounding, i.e. without visible facets, from selected parts. It also allows to launch programs of your choice. For example to automate the FreeCAD -> Slicer -> printing workflow.

After the creation of the stl file you can, for example, open your slicer with the stl file, switch on your printer, heat the printer bed and, if necessary, trigger additional commands in your home automation.



Principle of smoothing




The macro modifies the deviation property of the solids before creating the stl file and restores the original values afterwards. Next it can launch the stl file which will open for example under Cura if the stl extension has been associated with that program on your operating system.

Launching other programs or commands
The macro can launch additional programs or commands that you might type in a terminal:
 * Turn on the printer and the light (requires a computer controlled socket).
 * Connect Octoprint to the printer.
 * Start the tray preheating.
 * Save your FreeCAD and stl file somewhere.

Setup
Check that on your operating system, the stl extension is associated with your slicer. In other words, when you double-click an stl file, your slicer should open and load your stl file.

If you run the macro as it is, it will just create the stl without visible facets, but no others programs will be launched. For that you have to adapt the lines of code that are after  in the section Parameters that can be changed. Have a look at the comments in the Code.

Usage

 * 1) Select one or more solid objects to print.
 * 2) Start the macro.
 * 3) The dialog opens: [[File:Macro_3D_Printer_Workflow_Dialog.png]]
 * 4) Check the desired options in the left column.
 * 5) Enter the Accuracy (param deviation):
 * 6) * 0.5 is the default value in FreeCAD.
 * 7) * 0.05 allows a stronger smoothing.
 * 8) * 0.01 is perfect from a smoothing point of view.
 * 9) Press the  button.

The lower the deviation, the better the quality, but the larger the size of the stl file. The value must be between 0 and 1

Links

 * Forum discussion (french)
 * Macros recipes

Credits
Thanks to openBrain for the help on the code. Very good teacher! Thanks to Mario 52, David69 and Roy_043 for the help on this wiki.

Script
ToolBar Icon

Code
ver 00.02 21/01/2023 by 2cv001