Macro TreeToAscii/fr

Contexte
Cette macro a été écrite dans le but principal de documenter la construction du modèle. Elle génère une représentation artistique ASCII de l'arbre de construction d'objet(s) sélectionné(s).

Utilisation
Sélectionnez simplement le ou les objets dont vous souhaitez imprimer l'arborescence et exécutez la macro. Il affichera l'arborescence de chaque objet dans une boîte de dialogue. Tous les objets sélectionnés seront considérés comme étant au même niveau de hiérarchie en haut de l'arborescence (même s'ils ne sont pas dans le modèle réel). Une fois la boîte de dialogue ouverte, vous pouvez changer de style et / ou de motif et recréer l'arborescence ASCII.



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