Draft AutoGroup

Description
The AutoGroup tool sets a selected Std Group, or a related element like a Draft VisGroup, Arch Site, Arch Building or Arch BuildingPart, as the active auto-group. When an auto-group is set, new objects will be automatically moved to the indicated group upon being created.

Auto-grouping works with elements created with the Draft and Arch Workbenches.



Usage

 * 1) Select a, , or  in the tree view.
 * 2) Press the  button, or go to the menu . If no group is selected, a drop-down menu will display eligible groups to use, or "None".
 * 3) The button will change with the name of the active auto-group, for example,.

Notes:
 * The button is present in the Draft Tray toolbar, which only appears in the Draft and Arch Workbenches.
 * At least one of, , or must exist before using this tool.
 * To change the auto-group, select another group in the tree view and click . If no group is selected you have the option of choosing "None" to turn off auto-grouping.
 * When auto-grouping is active, new Draft and Arch objects will be placed in that group except when is on, in which case the new geometry will be placed in the Construction group.
 * Auto-grouping only works for objects created from the graphical user interface; objects created programmatically by macros or the Python console aren't automatically placed in groups. The user always has the possibility of programmatically doing the grouping, regardless of the auto-grouping settings.

Scripting
Draft API and FreeCAD Scripting Basics.

Adding objects to the active auto-group can be done in macros and from the Python console by using the following function:


 * Puts the element in the current auto-group.
 * If auto-grouping is disabled (the group is ), or if Construction mode is active, or if is already in the auto-group, the function doesn't do anything.
 * The function will fail if is already in another group that is different from the auto-group.
 * The function only does something if the graphical interface is active, as the auto-group can only be chosen from the graphical interface.

Example: