Draft AutoGroup: Difference between revisions
m (Docnav) |
(Use image for Tray button.) |
||
(65 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
<languages/> |
||
<translate> |
<translate> |
||
<!--T:14--> |
<!--T:14--> |
||
{{Docnav |
|||
{{Docnav|[[Draft Slope|Slope]]|[[Draft SetWorkingPlaneProxy|Set Working Plane Proxy]]|[[Draft_Module|Draft]]|IconL=Draft_Slope.svg|IconC=Workbench_Draft.svg|IconR=Draft_SetWorkingPlaneProxy.png}} |
|||
|[[Draft_ToggleConstructionMode|ToggleConstructionMode]] |
|||
|[[Draft_Snap_Lock|Snap Lock]] |
|||
|[[Draft_Workbench|Draft]] |
|||
|IconL=Draft_ToggleConstructionMode.svg |
|||
|IconR=Draft_Snap_Lock.svg |
|||
|IconC=Workbench_Draft.svg |
|||
}} |
|||
<!--T:1--> |
<!--T:1--> |
||
{{GuiCommand |
{{GuiCommand |
||
|Name=Draft AutoGroup |
|Name=Draft AutoGroup |
||
|Empty=1 |
|||
|MenuLocation=Draft → Utilities → AutoGroup |
|||
|Workbenches=[[ |
|Workbenches=[[Draft_Workbench|Draft]], [[Arch_Workbench|Arch]] |
||
|SeeAlso=[[Std Group]], [[Draft VisGroup]] |
|||
|Version=0.17 |
|Version=0.17 |
||
|SeeAlso=[[Draft_Layer|Draft Layer]], [[Std_Group|Std Group]] |
|||
}} |
}} |
||
== Description == <!--T: |
== Description == <!--T:17--> |
||
The AutoGroup tool sets a selected [[Std Group]], or a related element like a [[Draft VisGroup|Draft VisGroup]], [[Arch Site|Arch Site]], [[Arch Building|Arch Building]] or [[Arch BuildingPart|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. |
|||
<!--T: |
<!--T:2--> |
||
The '''Draft AutoGroup''' command changes the active [[Draft_Layer|Draft Layer]] or, [[#Preferences|optionally]], the active [[Std_Group|Std Group]] or group-like [[Arch_Workbench|Arch]] object. New [[Draft_Workbench|Draft]] and [[Arch_Workbench|Arch]] objects are automatically placed in this active layer or group. |
|||
Auto-grouping works with elements created with the [[Draft Workbench|Draft]] and [[Arch Workbench|Arch Workbenches]]. |
|||
<!--T:19--> |
|||
This command was originally intended for groups, hence its name, but was redesigned in FreeCAD version 0.19 when a layer system was introduced. Because handling layers is now the default for the command the rest of this page will primarily focus on layers. |
|||
</translate> |
</translate> |
||
[[Image: |
[[Image:Draft_tray_menu.png]] |
||
<translate> |
<translate> |
||
<!--T:9--> |
<!--T:9--> |
||
{{Caption|The layer menu of the Draft Tray}} |
|||
{{Caption|Draft Tray which sets the active auto-group by clicking on the folder icon and choosing a group}} |
|||
== |
==Usage== <!--T:18--> |
||
# Select a {{Button|[[Image:Group.svg|16px]] [[Std Group]]}}, {{Button|[[Image:Group.svg|16px]] [[Draft_ToggleConstructionMode|Construction group]]}}, or {{Button|[[Image:Draft_VisGroup.png|16px]] [[Draft VisGroup]]}} in the tree view. |
|||
<!--T:3--> |
|||
# Press the {{Button|[[Image:Draft AutoGroup_off.svg|16px]] None}} button, or go to the menu {{MenuCommand|Draft → Utilities → [[Image:Draft AutoGroup.png|16px]] [[Draft AutoGroup|AutoGroup]]}}. If no group is selected, a drop-down menu will display eligible groups to use, or "None". |
|||
# Optionally select the layer you want to make active in the [[Tree_view|Tree view]]. |
|||
# The button will change with the name of the active auto-group, for example, {{Button|[[Image:Draft AutoGroup_on.svg|16px]] Group}}. |
|||
# There are several ways to invoke the command: |
|||
#* Press the [[Image:Draft_tray_button_layer.png]] button in the [[Draft_Tray|Draft Tray]]. This button can look different. If there is an active layer it will show the name of the layer and a layer icon with the {{PropertyView|Line Color}} and {{PropertyView|Shape Color}} of the layer. |
|||
#* If you have selected a layer: select the {{MenuCommand|[[Image:button_right.svg|16px]] Activate this layer}} option from the [[Tree_view|Tree view]] context menu. |
|||
# If you have not yet selected a layer the layer menu opens. Do one of the following: |
|||
#* Select {{MenuCommand|None}} to work without an active layer. |
|||
#* Select an existing layer to make active. |
|||
#* Select {{MenuCommand|Add new Layer}} to create a new layer. Selecting this option will not change the active layer. |
|||
# If the active layer was changed the button in the [[Draft_Tray|Draft Tray]] is updated. |
|||
==Notes== <!--T:20--> |
|||
<!--T:5--> |
<!--T:5--> |
||
* A new [[Draft_Layer|layer]] can also be created by right-clicking the layer container in the [[Tree_view|Tree view]] and selecting the {{MenuCommand|[[Image:Draft_NewLayer.svg|16px]] Add new layer}} option from the context menu. |
|||
Notes: |
|||
* If [[Draft_ToggleConstructionMode|Draft construction mode]] is switched on the active [[Draft_Layer|layer]] is ignored. |
|||
* The {{Button|[[Image:Draft AutoGroup.svg|16px]] [[Draft AutoGroup|AutoGroup]]}} button is present in the [[Draft Tray]] toolbar, which only appears in the [[Draft Workbench|Draft]] and [[Arch Workbench]]es. |
|||
* At least one of {{Button|[[Image:Group.svg|16px]] [[Std Group]]}}, {{Button|[[Image:Group.svg|16px]] [[Draft_ToggleConstructionMode|Construction group]]}}, or {{Button|[[Image:Draft_VisGroup.png|16px]] [[Draft VisGroup]]}} must exist before using this tool. |
|||
==Preferences== <!--T:21--> |
|||
* To change the auto-group, select another group in the tree view and click {{Button|[[Image:Draft AutoGroup_on.svg|16px]] Group}}. If no group is selected you have the option of choosing "None" to turn off auto-grouping. |
|||
* When auto-grouping is active, new [[Draft Workbench|Draft]] and [[Arch Workbench|Arch]] objects will be placed in that group except when {{Button|[[Image:Draft Construction.svg|16px]] [[Draft_ToggleConstructionMode|Construction mode]]}} is on, in which case the new geometry will be placed in the Construction group. |
|||
<!--T:22--> |
|||
* 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. |
|||
See also: [[Preferences_Editor|Preferences Editor]] and [[Draft_Preferences|Draft Preferences]]. |
|||
<!--T:23--> |
|||
* This command can optionally also handle groups: {{MenuCommand|Edit → Preferences... → Draft → General → Include groups in layer list}}. |
|||
== Scripting == <!--T:6--> |
== Scripting == <!--T:6--> |
||
<!--T:10--> |
<!--T:10--> |
||
See also: [https://freecad.github.io/SourceDoc/ Autogenerated API documentation] and [[FreeCAD_Scripting_Basics|FreeCAD Scripting Basics]]. |
|||
<!--T:7--> |
<!--T:7--> |
||
If the [[Draft_Workbench|Draft Workbench]] is active the FreeCADGui application object has a {{incode|draftToolBar}} property. This {{incode|draftToolBar}} object has an {{incode|autogroup}} property, which contains the name of the active autogroup, or is {{incode|None}} if no autogroup is active. To change the active autogroup use the {{incode|setAutoGroup}} method of the {{incode|draftToolBar}} object. To put objects in the active autogroup use the {{incode|autogroup}} method of the Draft module. |
|||
Adding objects to the active auto-group can be done in [[macros]] and from the [[Python]] console by using the following function: |
|||
</translate> |
|||
{{Code|code= |
|||
autogroup(obj) |
|||
}} |
|||
<translate> |
|||
<!--T:11--> |
|||
* Puts the {{incode|obj}} element in the current auto-group. |
|||
* If auto-grouping is disabled (the group is {{incode|None}}), or if [[Draft_ToggleConstructionMode|Construction mode]] is active, or if {{incode|obj}} is already in the auto-group, the function doesn't do anything. |
|||
* The function will fail if {{incode|obj}} 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. |
|||
<!--T:12--> |
|||
Example: |
|||
</translate> |
</translate> |
||
{{Code|code= |
{{Code|code= |
||
# This code only works if the Draft Workbench is active! |
|||
import FreeCAD, Draft |
|||
import FreeCAD as App |
|||
Polygon1 = Draft.makePolygon(3, 500) |
|||
import FreeCADGui as Gui |
|||
Polygon2 = Draft.makePolygon(3, 1000) |
|||
import Draft |
|||
Polygon3 = Draft.makePolygon(5, 1500) |
|||
doc = App.newDocument() |
|||
FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroup", "Group") |
|||
polygon1 = Draft.make_polygon(5, radius=1000) |
|||
# Use the graphical interface to set "Group" for auto-grouping |
|||
polygon2 = Draft.make_polygon(3, radius=500) |
|||
polygon3 = Draft.make_polygon(6, radius=220) |
|||
Draft. |
layer = Draft.make_layer() |
||
Gui.draftToolBar.setAutoGroup(layer.Name) |
|||
Draft.autogroup(Polygon2) |
|||
Draft.autogroup(Polygon3) |
|||
Draft.autogroup(polygon1) |
|||
Draft.autogroup(polygon2) |
|||
Draft.autogroup(polygon3) |
|||
doc.recompute() |
|||
}} |
}} |
||
<translate> |
<translate> |
||
<!--T:13--> |
|||
{{Docnav|[[Draft Slope|Slope]]|[[Draft SetWorkingPlaneProxy|Set Working Plane Proxy]]|[[Draft_Module|Draft]]|IconL=Draft_Slope.svg|IconC=Workbench_Draft.svg|IconR=Draft_SetWorkingPlaneProxy.png}} |
|||
<!--T: |
<!--T:13--> |
||
{{Docnav |
|||
{{Draft Tools navi}} |
|||
|[[Draft_ToggleConstructionMode|ToggleConstructionMode]] |
|||
|[[Draft_Snap_Lock|Snap Lock]] |
|||
|[[Draft_Workbench|Draft]] |
|||
|IconL=Draft_ToggleConstructionMode.svg |
|||
|IconR=Draft_Snap_Lock.svg |
|||
|IconC=Workbench_Draft.svg |
|||
}} |
|||
<!--T:16--> |
|||
{{Userdocnavi}} |
|||
</translate> |
</translate> |
||
{{Draft Tools navi{{#translation:}}}} |
|||
{{clear}} |
|||
{{Userdocnavi{{#translation:}}}} |
Latest revision as of 17:37, 3 December 2023
Draft AutoGroup |
Menu location |
---|
None |
Workbenches |
Draft, Arch |
Default shortcut |
None |
Introduced in version |
0.17 |
See also |
Draft Layer, Std Group |
Description
The Draft AutoGroup command changes the active Draft Layer or, optionally, the active Std Group or group-like Arch object. New Draft and Arch objects are automatically placed in this active layer or group.
This command was originally intended for groups, hence its name, but was redesigned in FreeCAD version 0.19 when a layer system was introduced. Because handling layers is now the default for the command the rest of this page will primarily focus on layers.
The layer menu of the Draft Tray
Usage
- Optionally select the layer you want to make active in the Tree view.
- There are several ways to invoke the command:
- Press the button in the Draft Tray. This button can look different. If there is an active layer it will show the name of the layer and a layer icon with the ViewLine Color and ViewShape Color of the layer.
- If you have selected a layer: select the Activate this layer option from the Tree view context menu.
- If you have not yet selected a layer the layer menu opens. Do one of the following:
- Select None to work without an active layer.
- Select an existing layer to make active.
- Select Add new Layer to create a new layer. Selecting this option will not change the active layer.
- If the active layer was changed the button in the Draft Tray is updated.
Notes
- A new layer can also be created by right-clicking the layer container in the Tree view and selecting the Add new layer option from the context menu.
- If Draft construction mode is switched on the active layer is ignored.
Preferences
See also: Preferences Editor and Draft Preferences.
- This command can optionally also handle groups: Edit → Preferences... → Draft → General → Include groups in layer list.
Scripting
See also: Autogenerated API documentation and FreeCAD Scripting Basics.
If the Draft Workbench is active the FreeCADGui application object has a draftToolBar
property. This draftToolBar
object has an autogroup
property, which contains the name of the active autogroup, or is None
if no autogroup is active. To change the active autogroup use the setAutoGroup
method of the draftToolBar
object. To put objects in the active autogroup use the autogroup
method of the Draft module.
# This code only works if the Draft Workbench is active!
import FreeCAD as App
import FreeCADGui as Gui
import Draft
doc = App.newDocument()
polygon1 = Draft.make_polygon(5, radius=1000)
polygon2 = Draft.make_polygon(3, radius=500)
polygon3 = Draft.make_polygon(6, radius=220)
layer = Draft.make_layer()
Gui.draftToolBar.setAutoGroup(layer.Name)
Draft.autogroup(polygon1)
Draft.autogroup(polygon2)
Draft.autogroup(polygon3)
doc.recompute()
- Drafting: Line, Polyline, Fillet, Arc, Arc by 3 points, Circle, Ellipse, Rectangle, Polygon, B-spline, Cubic Bézier curve, Bézier curve, Point, Facebinder, ShapeString, Hatch
- Annotation: Text, Dimension, Label, Annotation styles, Annotation scale
- Modification: Move, Rotate, Scale, Mirror, Offset, Trimex, Stretch, Clone, Array, Polar array, Circular array, Path array, Path link array, Point array, Point link array, Edit, Subelement highlight, Join, Split, Upgrade, Downgrade, Wire to B-spline, Draft to sketch, Set slope, Flip dimension, Shape 2D view
- Draft Tray: Select plane, Set style, Toggle construction mode, AutoGroup
- Snapping: Snap lock, Snap endpoint, Snap midpoint, Snap center, Snap angle, Snap intersection, Snap perpendicular, Snap extension, Snap parallel, Snap special, Snap near, Snap ortho, Snap grid, Snap working plane, Snap dimensions, Toggle grid
- Miscellaneous: Apply current style, Layer, Manage layers, Add a new named group, Move to group, Select group, Add to construction group, Toggle normal/wireframe display, Create working plane proxy, Heal, Show snap toolbar
- Additional: Constraining, Pattern, Preferences, Import Export Preferences, DXF/DWG, SVG, OCA, DAT
- Context menu:
- Layer container: Merge layer duplicates, Add new layer
- Layer: Activate this layer, Select layer contents
- Text: Open hyperlinks
- Wire: Flatten
- Working plane proxy: Write camera position, Write objects state
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
- Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, Arch, Assembly, CAM, Draft, FEM, Inspection, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Start, Surface, TechDraw, Test Framework, Web
- Hubs: User hub, Power users hub, Developer hub