Sketcher ToggleActiveConstraint: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 41: Line 41:
#* In the {{MenuCommand|Constraints}} section of the [[Task_panel|Task panel]] select the {{MenuCommand|Activate}} or {{MenuCommand|Deactivate}} option from the context menu. The offered option depends on the state of the constraint under the cursor.
#* In the {{MenuCommand|Constraints}} section of the [[Task_panel|Task panel]] select the {{MenuCommand|Activate}} or {{MenuCommand|Deactivate}} option from the context menu. The offered option depends on the state of the constraint under the cursor.
#* Use the keyboard shortcut: {{KEY|K}} then {{KEY|Z}}.
#* Use the keyboard shortcut: {{KEY|K}} then {{KEY|Z}}.
# Active selected constraints are deactivated and turn grey (default [[Sketcher_Preferences#Appearance|color]]) while deactivated selected constraints are activated and return to red (default color).
# Active selected constraints are deactivated and turn grey (default [[Sketcher_Preferences#Appearance|color]]) while deactivate selected constraints are activated and return to red (default color).


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

Revision as of 18:10, 23 March 2024

This documentation is a work in progress. Please don't mark it as translatable since it will change in the next hours and days.

Sketcher ToggleActiveConstraint

Menu location
Sketch → Sketcher constraints → Activate/deactivate constraint
Workbenches
Sketcher
Default shortcut
K Z
Introduced in version
0.19
See also
Sketcher ToggleDrivingConstraint

Description

The Sketcher ToggleActiveConstraint tool activates or deactivates selected constraints. Deactivating constraints allows you to test other geometry arrangements without deleting constraints.

This is tool is similar to Sketcher ToggleDrivingConstraint, but contrary to that tool also works for geometric constraints, and values of deactivated dimensional constraints are preserved.

Usage

  1. Select one or more constraints.
  2. There are several ways to invoke the tool:
    • Press the Activate/deactivate constraint button.
    • Select the Sketch → Sketcher constraints → Activate/deactivate constraint option from the menu.
    • introduced in version 0.22: Right-click in the 3D view and select the Activate/deactivate constraint option from the context menu.
    • In the Constraints section of the Task panel select the Activate or Deactivate option from the context menu. The offered option depends on the state of the constraint under the cursor.
    • Use the keyboard shortcut: K then Z.
  3. Active selected constraints are deactivated and turn grey (default color) while deactivate selected constraints are activated and return to red (default color).

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(index)

Use the toggleActive method of an existing Sketcher SketchObject, and the index of the constraint to activate it or deactivate it. The index starts from 0 all the way to N-1, where N is the total number of constraints.

Example:

import FreeCAD as App

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