Macro documentation/fr

Description
Toutes les macros doivent être correctement documentées de la même manière que les commandes Gui Command. Elles doivent avoir une page wiki individuelle et être répertoriés dans l'une des catégories de Recettes Macros.

La page recettes de macro contient une belle sélection de macros créées par des utilisateurs expérimentés, et peuvent être installées directement à partir de l'utilitaire Addon Manager.

Voir le Modèle GuiCommand et les pages de macros comme la Macro Loft et Macro Site From Contours pour voir comment documenter les macros. Au moins deux sections doivent être incluses, une section avec des informations générales sur l’utilisation et une section  pour contenir le code réel de la macro. D'autres sections peuvent être incluses si nécessaire pour expliquer plus en détail l'utilisation de la macro.

Si une macro fournit une fonctionnalité bien définie et est bien documentée, elle pourrait éventuellement être incluse dans un nouvel atelier ou un atelier existant.

Ajouter de nouvelles macros
Créez une nouvelle page pour la macro commençant par le mot, par exemple,. Le lien peut être utilisé sans trait de soulignement sous la forme, ce qui entraîne Excellente modification de macro; les espaces sont automatiquement convertis en traits de soulignement.

In the new page you should use Template:Macro at the top, with a minimum of information:

You can add a custom icon if it doesn't have the same name as the macro; you can also add other fields of information.

When translating the page, use a localized template. You need to specify the name with the two letter language code, and you need to indicate the icon explicitly

or use the field


 * Use Special:Upload to upload the custom icon in SVG or PNG formats. It should have the same name as the macro.
 * Otherwise it will default to  [[Image:Text-x-python.png|32px]].

Template:Macro will put the information on using and installing the macros in every page.



Adding the macro documentation

 * Just like a Gui Command, explain what the macro does, its inputs, outputs, options, and limitations, if any.
 * Include a personalized icon in SVG or PNG format for your macro so that other users can include it in a custom toolbar.
 * Add one or more images to clarify the usage of your tool.
 * If the macro performs a complex task, consider adding an animated GIF to showcase its capabilities. The GIF image should have a maximum size of 500 x 500 pixels; if the GIF is bigger, the animation may not work. Do not resize the GIF as the wiki will not play resized GIFs.
 * Mention related macros and workbenches that complement the function of this tool.
 * Mention the version of FreeCAD used to create the macro. This information can be gathered from.


 * When this information is pasted, it looks like this

Consider adding this information in a comment block inside the code of the macro.

Adding the macro code
Inside the section, use Template:Code to place the code of the macro in the page. This will create a block of text that uses monospace font, which will preserve the whitespace that is essential for Python.

Add header information before your actual code.

This information can be used by the addons_installer.FCMacro macro, or by the Plugin Loader program, to install the macro and check for new versions. Starting with FreeCAD 0.17, this information is also used by the Addon Manager, which downloads the macro from the FreeCAD-macros repository.

Adding macro code outside of the wiki
If your macro is too big that it exceeds 64 KB, it won't be able to be hosted on the wiki. In this case, use Template:Codeextralink with a link to the raw web address of the code.

For example:

It will be displayed as:

This template must be placed at the beginning of the macro page, in the section. It must be the first block of code in the page so that the Addon Manager can automatically detect it and import it. See Macro CirclePlus for an example of the usage.

Adding the new macro to the wiki repository
Use Template:MacroLink to include a line in the appropriate category in Macros recipes; create a new category if needed.


 * The first argument is the name of the macro page in the wiki.
 * The second argument is the displayed text, which may be different from the page name. This will create a link to the first argument, showing the second argument as the text.
 * A short description of the macro comes after the colon.

You can also use the optional parameter  to specify the image file that will be placed at the start of the line. The icon should be an SVG or a PNG file, and should have the same name as your macro. If this parameter is not given it will use the default icon for a Python script.

To localize this template, use the appropriate language link in the first argument.

Adding the new macro to the central repository
To make a macro installable from the Addon Manager it should be included in the central FreeCAD-macros repository.

In order to include the macro there, first it must be reviewed by the FreeCAD community in the Python scripting and macros subforum. Once this is done, the FreeCAD-macros repository should be forked, the new macro should be included in a branch, and then the branch should be pushed and merged into the upstream repository.