Sketcher ConstrainCoincident: Difference between revisions

From FreeCAD Documentation
(Marked this version for translation)
 
(90 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
<translate>
<translate>

<!--T:37-->
<!--T:37-->
{{Docnav
{{Docnav
|[[Sketcher_ConstrainCoincidentUnified|Coincident (unified)]]
|[[Sketcher_ToggleConstruction|Construction Mode]]
|[[Sketcher_ConstrainPointOnObject|Point On Object]]
|[[Sketcher_ConstrainPointOnObject|Point on object]]
|[[Sketcher_Workbench|Sketcher]]
|[[Sketcher_Workbench|Sketcher]]
|IconL=Sketcher_ToggleConstruction.svg
|IconL=Sketcher_ConstrainCoincidentUnified.svg
|IconR=Constraint_PointOnObject.svg
|IconR=Constraint_PointOnObject.svg
|IconC=Workbench_Sketcher.svg
|IconC=Workbench_Sketcher.svg
Line 17: Line 18:
|Workbenches=[[Sketcher_Workbench|Sketcher]]
|Workbenches=[[Sketcher_Workbench|Sketcher]]
|Shortcut={{KEY|C}}
|Shortcut={{KEY|C}}
|SeeAlso=[[Sketcher_ConstrainLock|Sketcher Constrain Lock]], [[Sketcher ConstrainPointOnObject|Sketcher Constrain Point onto Object]]
|SeeAlso=[[Sketcher_ConstrainCoincidentUnified|Sketcher ConstrainCoincidentUnified]], [[Sketcher_ConstrainPointOnObject|Sketcher ConstrainPointOnObject]]
}}
}}


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


<!--T:2-->
<!--T:47-->
The [[Image:Sketcher_ConstrainCoincident.svg|24px]] [[Sketcher_ConstrainCoincident|Sketcher ConstrainCoincident]] tool creates a coincident constraint between points, or ({{Version|0.21}}) a concentric constraint between circles, arcs and/or ellipses (by making their centers coincident).
Create a coincident constraint on the selected item


<!--T:5-->
<!--T:49-->
{{Version|1.0}}: This tool is replaced by the [[Sketcher_ConstrainCoincidentUnified|Sketcher ConstrainCoincidentUnified]] tool if the '''Unify Coincident and PointOnObject''' option is selected in the [[Sketcher_Preferences#General|preferences]].
This constraint tool takes two points as its argument and serves to make the two points ''coincident''. (Meaning to make them as-one-point).


<!--T:6-->
==Usage== <!--T:41-->
In practical terms this constraint tool is useful when there is a break in a profile for example - where two lines end near each other and need to be joined - a coincident constraint on their end-points will close the gap.


==Usage== <!--T:41-->
<!--T:50-->
See also: [[Sketcher_Workbench#Drawing_aids|Drawing aids]].


===[[Sketcher_Workbench#Continue_modes|Continue mode]]=== <!--T:51-->
<!--T:3-->
As stated above, this tool takes two arguments - both are points.
# First, it is necessary to highlight two distinct points. ({{Emphasis|Note:}} this will not work if, for example, you attempt to select the start and end point of the same line).
# Highlighting of a drawing item is achieved by moving the mouse over the item and clicking the left-mouse-button.
# A highlighted item will change its color to green. (This color can be customized in {{MenuCommand|Editing → Preference → Display → Colors → Selection}})
# Subsequent items can be highlighted by repeating the above procedure(s). {{Emphasis|Note:}} it's unnecessary to hold-down any special key like {{KEY|Ctrl}} to achieve multiple item selection in a drawing.
# Once you have two points highlighted, you can invoke the command using several methods:
#* Pressing on the {{Button|[[File:Sketcher_ConstrainCoincident.svg|16px]] [[Sketcher_ConstrainCoincident|Coinstrain coincident]]}} constraint button in the toolbar.
#* Using the {{KEY|C}} keyboard shortcut.
#* Using the {{MenuCommand|Sketch → Sketcher constraints → Constrain coincident}} entry in the top menu.
{{Emphasis|Result:}} the command will cause the two points to become ''coincident'' and be replaced by a single point.


<!--T:7-->
<!--T:48-->
# Make sure there is no selection.
{{Emphasis|Note:}} In order to make two points coincident, FreeCAD must out of necessity move one (or both) of the original points.
# There are several ways to invoke the tool:
#* Press the {{Button|[[Image:Sketcher_ConstrainCoincident.svg|16px]] [[Sketcher_ConstrainCoincident|Constrain coincident]]}} button.
#* Select the {{MenuCommand|Sketch → Sketcher constraints → [[Image:Sketcher_ConstrainCoincident.svg|16px]] Constrain coincident}} option from the menu.
#* Use the keyboard shortcut: {{KEY|C}}.
# The cursor changes to a cross with the tool icon.
# Do one of the following:
#* Select two points.
#* Select two edges of circles, arcs, ellipses or arcs of ellipses.
# A constraint is added.
# Optionally keep creating constraints.
# To finish, right-click or press {{KEY|Esc}}, or start another geometry or constraint creation tool.

===Run-once mode=== <!--T:52-->

<!--T:53-->
# Do one of the following:
#* Select two or more points.
#* Select two or more edges of circles, arcs, ellipses or arcs of ellipses.
# Invoke the tool as explained above.
# Depending on the selection one or more constraints are added.

==Notes== <!--T:54-->

<!--T:55-->
* {{Version|1.0}}: Points with Coincident constraints are marked with the '''Constraint symbols''' [[Sketcher_Preferences#Display|color]].


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

The constraint can be created from macros and from the python console by using the following command:
<!--T:44-->
The constraint can be created from [[Macros|macros]] and from the [[Python|Python]] console by using the following command:

</translate>
</translate>
{{Code|code=Sketch.addConstraint(Sketcher.Constraint('Coincident',LineFixed,PointOfLineFixed,LineMoving,PointOfLineMoving)) }}
{{Code|code=Sketch.addConstraint(Sketcher.Constraint('Coincident',LineFixed,PointOfLineFixed,LineMoving,PointOfLineMoving)) }}
<translate>
<translate>

<!--T:9-->
<!--T:9-->
where :
where :
Line 61: Line 81:
* {{incode|PointOfLineMoving}} indicates which vertex of {{incode|LineMoving}} has to fulfill the constraint
* {{incode|PointOfLineMoving}} indicates which vertex of {{incode|LineMoving}} has to fulfill the constraint


<!--T:45-->
The [[Scritping Sketcher constraints in Python]] page explains the values which can be used for {{incode|LineFixed}}, {{incode|PointOfLineFixed}}, {{incode|LineMoving}} and {{incode|PointOfLineMoving}}, and contains further examples on how to create constraints from Python scripts.
As the names {{incode|LineFixed}} and {{incode|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.


<!--T:46-->
=== Alternatives to Coincident constraint ===
The [[Sketcher_scripting|Sketcher scripting]] page explains the values which can be used for {{incode|LineFixed}}, {{incode|PointOfLineFixed}}, {{incode|LineMoving}} and {{incode|PointOfLineMoving}}, and contains further examples on how to create constraints from Python scripts.


The two constrained items must be starting point (1) or end point (2) vertices, or center points (3). The coincident constraint cannot be used directly with an entire edge (0). [[File:Sketcher_CompCreateCircle.png|32px]][[Sketcher CompCreateCircle|Circles]] and [[File:Sketcher_CompCreateConic.png|32px]][[Sketcher CompCreateConic|Conics]] (ellipses) have a center point, but {{incode|3}} cannot be used to refer to the center point of a straight [[File:Sketcher_CreateLine.svg|32px]][[Sketcher CreateLine|Lines]]. The combinations which are not possible with [[File:Sketcher_ConstrainCoincident.svg|32px]][[Sketcher ConstrainCoincident|Coincident]] can be emulated using other constraints:
* The [[File:Sketcher_ConstrainSymmetric.svg|32px]][[Sketcher ConstrainSymmetric|Symmetric]] constraint can be used to place an extremity on the midpoint of a straight line. This emulates 3 (center) for straight lines.
* A midpoint-to-midpoint placement can be achieved by creating a new [[File:Sketcher_CreatePoint.svg|32px]][[Sketcher CreatePoint|Point]] and using two [[File:Sketcher_ConstrainSymmetric.svg|32px]][[Sketcher ConstrainSymmetric|Symmetric]] constraints so that it lays on the midpoint of both edges. This emulates 3 (center) for straight lines.
* Instead of using the values 1 or 2 (vertex) and 0 (edge), a vertex can be constrained to lie along on an edge using a [[File:Sketcher_ConstrainPointOnObject.svg|32px]][[Sketcher ConstrainPointOnObject|PointOnObject]] constraint. Note that with this constraint, the point can lie anywhere on the full extension of a segment or curve (i.e. before the start point or outside of the end point).
* Instead of using the values 0 (edge) and 0 (edge), a co-linear placement can be obtained by combining a [[File:Sketcher_ConstrainPointOnObject.svg|32px]][[Sketcher ConstrainPointOnObject|PointOnObject]] constraint and a [[File:Sketcher_ConstrainParallel.svg|32px]][[Sketcher ConstrainParallel|Parallel]] constraint
* Instead of using the values 0 (edge) and 0 (edge), two edges can be made identical by using two [[File:Sketcher_ConstrainCoincident.svg|32px]][[Sketcher ConstrainCoincident|Coincident]] constraint, one for each pair of extremities.
* Instead of using the values 0 (edge) and 0 (edge), two [[File:Sketcher_CreateCircle.svg|32px]][[Sketcher CompCreateCircle|Circle]] can be made identical by creating a new [[File:Sketcher_CreateLine.svg|32px]][[Sketcher CreateLine|Line]] and using two [[File:Sketcher_ConstrainCoincident.svg|32px]][[Sketcher ConstrainCoincident|Coincident]] constraint to place both centers on one extremity of the line, and two [[File:Sketcher_ConstrainPointOnObject.svg|32px]][[Sketcher ConstrainPointOnObject|PointOnObject]] constraints to place the other extremity on the circumference of both circles. To get rid of the extra degree of freedom, a horizontal or vertical constraint can be used to lock the line in place.


<!--T:33-->
<!--T:33-->
{{Docnav
{{Docnav
|[[Sketcher_ConstrainCoincidentUnified|Coincident (unified)]]
|[[Sketcher_ToggleConstruction|Construction Mode]]
|[[Sketcher_ConstrainPointOnObject|Point On Object]]
|[[Sketcher_ConstrainPointOnObject|Point on object]]
|[[Sketcher_Workbench|Sketcher]]
|[[Sketcher_Workbench|Sketcher]]
|IconL=Sketcher_ToggleConstruction.svg
|IconL=Sketcher_ConstrainCoincidentUnified.svg
|IconR=Constraint_PointOnObject.svg
|IconR=Constraint_PointOnObject.svg
|IconC=Workbench_Sketcher.svg
|IconC=Workbench_Sketcher.svg
Line 84: Line 99:


</translate>
</translate>
{{Sketcher Tools navi{{#translation:}}}}
{{Sketcher_Tools_navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Latest revision as of 14:49, 23 April 2024

Sketcher ConstrainCoincident

Menu location
Sketch → Sketcher constraints → Constrain coincident
Workbenches
Sketcher
Default shortcut
C
Introduced in version
-
See also
Sketcher ConstrainCoincidentUnified, Sketcher ConstrainPointOnObject

Description

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

introduced in version 1.0: This tool is replaced by the Sketcher ConstrainCoincidentUnified tool if the Unify Coincident and PointOnObject option is selected in the preferences.

Usage

See also: Drawing aids.

Continue mode

  1. Make sure there is no selection.
  2. There are several ways to invoke the tool:
    • Press the Constrain coincident button.
    • Select the Sketch → Sketcher constraints → Constrain coincident 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

  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 explained above.
  3. Depending on the selection one or more constraints are added.

Notes

Scripting

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.