Macro 3D Printer Workflow

Description
Macro that creates an "stl" file with perfect rounding = without visible facets. It also allows to launch programs of your choice For example to automate the FreeCAD -> Slicer -> printing line

Principle of smoothing :
With facets without facet :

Program modifies the deviation property of the solids before generation of the stl and then replace the old values.

At the end, it proposes to launch the stl file which will open for example under cura if the stl extension has been associated with cura in your operating system.

Launching other programs or commands :
You can ask it to chain any program or command that you might type in a terminal.

Examples of applications:
- Turn on the printer and the light (requires for example a controlled socket)

- Connect octoprint to the printer

- Start the tray preheating

- Save your FreeCAD and stl file somewhere

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

If you run the macro as it is, this will be ok for the generation of the stl without facet, but the others programs launches will not be ok. To be able to launch other programs (launch octoprint...), you have to adapt the lines of code that are after commands=[ in the section "Parameters that can be changed" have a lokk at the comments in the code.

Instructions for use
When you run the macro : Accuracy (param deviation) : 0.5 is the default value in FreeCad, 0.05 allows a stronger smoothing. 0.01 is perfect from a smoothing point of view. The lower the value, the better the quality, but the larger the size of the stl file

The value must be between 0 and 1

Versions
ver 00.02 21/01/2023 by 2cv001

Links
Forum : https://forum.freecadweb.org/viewtopic.php?f=12&t=52138

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