Macro TreeToAscii/it

Contesto
Questa macro è stata scritta principalmente per documentare la costruzione del modello. Genera una rappresentazione in stile ASCII dell'albero di costruzione degli oggetti selezionati.

Utilizzo
Just select the object(s) you want to print the tree and run the macro. It will display the tree of each object in a dialog. All selected objects will be considered as being at the same hierarchy level at the top of the tree (even if they aren't in the real model). Once dialog is open, you can change style and/or pattern and re-generate the ASCII tree.



Several styles are provided, at this time mainly to support systems that can encounter problems with Unicode encoding : Creating your own style should not be too difficult by editing the macro and changing/adding a style to 'STYLES' variable. Selected style choice is saved in FreeCAD parameters.
 * Modern : (default) uses Unicode characters to display forks and branches
 * Baroque : another Unicode style with larger indentation
 * ASCII : pure ASCII representation of forks and branches

Line pattern is can be customized. It supports different defined metadata : Default pattern is '{LBL} ({SNAM})', which means eg. object 'Box001' labeled 'myCube' will be displayed as 'myCube (Box001)'. Notice virtually all characters are allowed. If you want to print curly braces, they need to be doubled. Eg. with same example object, pattern '{LBL} (SNAME) =>' will print 'myCube (Box) {Part::Box} =>'. Available metadata are available in the tooltip of the pattern editing field so you don't need to remember it. Line pattern is saved in FreeCAD parameters.
 * {LBL} : object Label (displayed label)
 * {NAM} : object Name (internal name) eg. 'Box001'
 * {SNAM} : object ShortName (without digits) eg. 'Box001' will be displayed as 'Box'
 * {TYP} : object Type eg. 'Part::MultiFuse'
 * {BTYP} : object BaseType eg. 'Part::MultiFuse' will be displayed as 'Part'
 * {STYP} : object ShortType (without base) eg. 'Part::MultiFuse' will be displayed as 'MultiFuse'

Once dialog is open, several actions are available :
 * Copy to clipboard : copies the whole tree to your clipboard
 * Save to file : saves the whole tree to an arbitrary file on your system
 * Embed in text file : stores the whole tree in a text file embedded in the document (available since FC 0.18.4)
 * Of course you can copy any part of the tree by selecting it and using standard copy commands

Installation
The macro is available through Addon Manager. Code is provided on this page for convenience in case user system doesn't have git-python. Though it should be up-to-date, latest release is always available at FreeCAD-macro repository

For more detailed explanations, see the How to install macros page.

Forum discussion
For any feedback (bug, feature request, comments, ...), please use this forum thread : https://forum.freecadweb.org/viewtopic.php?f=22&t=43504

Code
Macro_FCTree2Ascii.FCMacro