Sketcher ToggleActiveConstraint: Difference between revisions

From FreeCAD Documentation
(→‎Scripting: Example:)
(Marked this version for translation)
Line 2: Line 2:
<translate>
<translate>


<!--T:1-->
{{Docnav
{{Docnav
|[[Sketcher_ConstrainInternalAlignment|Internal Alignment]]
|[[Sketcher_ConstrainInternalAlignment|Internal Alignment]]
Line 11: Line 12:
}}
}}


<!--T:2-->
{{GuiCommand
{{GuiCommand
|Name=Sketcher ToggleActiveConstraint
|Name=Sketcher ToggleActiveConstraint
Line 19: Line 21:
}}
}}


==Description==
==Description== <!--T:3-->


<!--T:4-->
[[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]] allows you to activate and deactivate an already placed constraint. This allows you to keep the constraint in the background but temporarily test another arrangement of the existing geometry.
[[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]] allows you to activate and deactivate an already placed constraint. This allows you to keep the constraint in the background but temporarily test another arrangement of the existing geometry.


<!--T:5-->
The {{Button|[[File:Sketcher_ToggleDrivingConstraint.svg|16px]] [[Sketcher_ToggleDrivingConstraint|Toggle driving constraint]]}} tool is similar in that it disables the effect of the constraint; however, with this tool, the constraint does not keep its old value. On the other hand, with {{Button|[[File:Sketcher_ToggleActiveConstraint.svg|16px]] [[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]]}} you can re-activate the old constraint immediately.
The {{Button|[[File:Sketcher_ToggleDrivingConstraint.svg|16px]] [[Sketcher_ToggleDrivingConstraint|Toggle driving constraint]]}} tool is similar in that it disables the effect of the constraint; however, with this tool, the constraint does not keep its old value. On the other hand, with {{Button|[[File:Sketcher_ToggleActiveConstraint.svg|16px]] [[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]]}} you can re-activate the old constraint immediately.


== Usage ==
== Usage == <!--T:6-->


<!--T:7-->
# Select an already placed constraint, then press {{Button|[[File:Sketcher_ToggleActiveConstraint.svg|16px]] [[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]]}}.
# Select an already placed constraint, then press {{Button|[[File:Sketcher_ToggleActiveConstraint.svg|16px]] [[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]]}}.
# Alternatively, got to the [[task_panel|task panel]], to the {{MenuCommand|Constraints}} section, select the constraint, then open the context menu (right-click), and select {{MenuCommand|Deactivate}}.
# Alternatively, got to the [[task_panel|task panel]], to the {{MenuCommand|Constraints}} section, select the constraint, then open the context menu (right-click), and select {{MenuCommand|Deactivate}}.
# To activate the constraint again, select it, and press {{Button|[[File:Sketcher_ToggleActiveConstraint.svg|16px]] [[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]]}} again.
# To activate the constraint again, select it, and press {{Button|[[File:Sketcher_ToggleActiveConstraint.svg|16px]] [[Sketcher_ToggleActiveConstraint|ToggleActiveConstraint]]}} again.


== Examples ==
== Examples == <!--T:8-->


</translate>
</translate>
[[File:Sketcher_ToggleActiveConstraint_example_active.png|x350px]]
[[File:Sketcher_ToggleActiveConstraint_example_active.png|x350px]]
<translate>
<translate>
<!--T:9-->
{{Caption|Fully constrained sketch.}}
{{Caption|Fully constrained sketch.}}


Line 41: Line 47:
[[File:Sketcher_ToggleActiveConstraint_example_disabled_1.png|x350px]] [[File:Sketcher_ToggleActiveConstraint_example_disabled_2.png|x350px]]
[[File:Sketcher_ToggleActiveConstraint_example_disabled_1.png|x350px]] [[File:Sketcher_ToggleActiveConstraint_example_disabled_2.png|x350px]]
<translate>
<translate>
<!--T:10-->
{{Caption|Left: deactivated constraint; the sketch is no longer fully constrained. Right: the unconstrained geometry can be moved around; the older constraint is still available, and can be re-activated to return to the fully constrained sketch.}}
{{Caption|Left: deactivated constraint; the sketch is no longer fully constrained. Right: the unconstrained geometry can be moved around; the older constraint is still available, and can be re-activated to return to the fully constrained sketch.}}


<!--T:11-->
[[File:Sketcher_ToggleActiveConstraint_task_panel.png|x350px]]
[[File:Sketcher_ToggleActiveConstraint_task_panel.png|x350px]]
{{Caption|Task panel with the deactivated constraint.}}
{{Caption|Task panel with the deactivated constraint.}}


== Scripting ==
== Scripting == <!--T:12-->


<!--T:13-->
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].
{{Emphasis|See also:}} [[FreeCAD Scripting Basics|FreeCAD Scripting Basics]].


<!--T:14-->
The active status of a constraint can be controlled in [[macros|macros]] and from the [[Python_console|Python console]].
The active status of a constraint can be controlled in [[macros|macros]] and from the [[Python_console|Python console]].
</translate>
</translate>
Line 57: Line 67:
<translate>
<translate>


<!--T:15-->
Use the {{incode|toggleActive}} method of an existing [[Sketcher_SketchObject|Sketcher SketchObject]], and the {{incode|number}} of the constraint to activate it or deactivate it.
Use the {{incode|toggleActive}} method of an existing [[Sketcher_SketchObject|Sketcher SketchObject]], and the {{incode|number}} of the constraint to activate it or deactivate it.


<!--T:16-->
Example:
Example:
</translate>
</translate>
Line 69: Line 81:
<translate>
<translate>


<!--T:17-->
{{Docnav
{{Docnav
|[[Sketcher_ConstrainInternalAlignment|Internal Alignment]]
|[[Sketcher_ConstrainInternalAlignment|Internal Alignment]]

Revision as of 21:31, 25 February 2020

Sketcher ToggleActiveConstraint

Menu location
Sketch → Sketcher constraints → Toggle activate/deactivate constraint
Workbenches
Sketcher
Default shortcut
None
Introduced in version
0.19
See also
Toggle driving constraints

Description

ToggleActiveConstraint allows you to activate and deactivate an already placed constraint. This allows you to keep the constraint in the background but temporarily test another arrangement of the existing geometry.

The Toggle driving constraint tool is similar in that it disables the effect of the constraint; however, with this tool, the constraint does not keep its old value. On the other hand, with ToggleActiveConstraint you can re-activate the old constraint immediately.

Usage

  1. Select an already placed constraint, then press ToggleActiveConstraint.
  2. Alternatively, got to the task panel, to the Constraints section, select the constraint, then open the context menu (right-click), and select Deactivate.
  3. To activate the constraint again, select it, and press ToggleActiveConstraint again.

Examples

Fully constrained sketch.

Left: deactivated constraint; the sketch is no longer fully constrained. Right: the unconstrained geometry can be moved around; the older constraint is still available, and can be re-activated to return to the fully constrained sketch.

Task panel with the deactivated constraint.

Scripting

See also: FreeCAD Scripting Basics.

The active status of a constraint can be controlled in macros and from the Python console.

SketchObject.toggleActive(number)

Use the toggleActive method of an existing Sketcher SketchObject, and the number of the constraint to activate it or deactivate it.

Example:

import FreeCAD App

sketch = App.ActiveDocument.Sketch
sketch.toggleActive(3)