Jump to content

Sketcher ConstrainCoincident

From FreeCAD Documentation

Sketcher ConstrainCoincident

Menu location
Sketch → Constraints → Coincident Constraint
Workbenches
Sketcher
Default shortcut
C
Introduced in version
-
See also
Sketcher ConstrainCoincidentUnified, Sketcher ConstrainPointOnObject

Description[edit | edit source]

The Sketcher ConstrainCoincident tool creates a coincident constraint between points, or (introduced in 0.21) a concentric constraint between circles, arcs and/or ellipses (by making their centers coincident).

introduced in 1.0: This tool is replaced by the Sketcher ConstrainCoincidentUnified tool if the Unify coincident and point-on-object constraints option is selected in the preferences.

Usage[edit | edit source]

See also: Drawing aids.

Continue mode[edit | edit source]

  1. Make sure there is no selection.
  2. There are several ways to invoke the tool:
    • Press the Coincident Constraint button.
    • Select the Sketch → Constraints → Coincident Constraint option from the menu.
    • Use the keyboard shortcut: C.
  3. The cursor changes to a cross with the tool icon.
  4. Do one of the following:
    • Select two points.
    • Select two edges of circles, arcs, ellipses or arcs of ellipses.
  5. A constraint is added.
  6. Optionally keep creating constraints.
  7. To finish, right-click or press Esc, or start another geometry or constraint creation tool.

Run-once mode[edit | edit source]

  1. Do one of the following:
    • Select two or more points.
    • Select two or more edges of circles, arcs, ellipses or arcs of ellipses.
  2. Invoke the tool as described above, or with the following additional option:
    • Right-click in the Elements section of the Sketcher Dialog and select the Coincident Constraint option from the context menu.
  3. Depending on the selection one or more constraints are added.

Notes[edit | edit source]

Scripting[edit | edit source]

The constraint can be created from macros and from the Python console by using the following command:

Sketch.addConstraint(Sketcher.Constraint('Coincident',LineFixed,PointOfLineFixed,LineMoving,PointOfLineMoving))

where :

  • Sketch is a sketch object
  • LineFixed is the number of the line, that will not move by applying the constraint
  • PointOfLineFixed indicates which vertex of LineFixed has to fulfill the constraint
  • LineMoving is the number of the line, that will move by applying the constraint
  • PointOfLineMoving indicates which vertex of LineMoving has to fulfill the constraint

As the names LineFixed and LineMoving indicate, if both constrained vertices are free to move in any direction, the first one (first to be selected in the Gui) will remain fixed and the other one will move. In the presence of existing constraints, however, both edges may move.

The Sketcher scripting page explains the values which can be used for LineFixed, PointOfLineFixed, LineMoving and PointOfLineMoving, and contains further examples on how to create constraints from Python scripts.