Sketcher ConstrainCoincident/es: Difference between revisions

From FreeCAD Documentation
(Part of translatable page "Constraint PointOnPoint")
No edit summary
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{GuiCommand/es|Name=Constraint PointOnPoint|Workbenches=[[Sketcher Workbench/es|Croquizador]], [[PartDesign Workbench/es|Diseño de Piezas]]|MenuLocation=Croquizador → Restricciones del Croquizador → Coincidente|SeeAlso=[[Constraint Lock/es|Bloquear]], [[Constraint PointOnObject/es|Punto en objeto]]}}


{{Docnav
|[[Sketcher_ToggleConstruction|Construction Mode]]
|[[Sketcher_ConstrainPointOnObject|Point On Object]]
|[[Sketcher_Workbench|Sketcher]]
|IconL=Sketcher_ToggleConstruction.svg
|IconR=Constraint_PointOnObject.svg
|IconC=Workbench_Sketcher.svg
}}

<div class="mw-translate-fuzzy">
{{GuiCommand/es
|Icon=Constraint PointOnPoint.svg
|Name/es=Restricción de coincidencia
|Workbenches=[[Sketcher Workbench/es|Sketcher]]
|Shortcut=C
|MenuLocation=Sketch → Restricciones de croquis → Restricción de coincidencia|SeeAlso=[[Sketcher_ConstrainLock/es|Restricción de bloqueo]], [[Sketcher_ConstrainPointOnObject/es|Punto en objeto]]
}}
</div>

==Description==

<div class="mw-translate-fuzzy">
"Crea una restricción de coincidencia en los objetos seleccionados"
"Crea una restricción de coincidencia en los objetos seleccionados"


Line 7: Line 28:


Esta restricción permite hacer dos puntos <em>coincidentes</em>.
Esta restricción permite hacer dos puntos <em>coincidentes</em>.
</div>


This constraint tool takes two points as its argument and serves to make the two points ''coincident''. (Meaning to make them as-one-point).
This constraint tool takes two points as its argument and serves to make the two points ''coincident''. (Meaning to make them as-one-point).
Line 12: Line 34:
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.
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==

<div class="mw-translate-fuzzy">
==Utilización==
==Utilización==


#Selecciona dos puntos.
#Selecciona dos puntos.
#Selecciona la restricción 'Coincidencia' y los dos puntos pasarán a ser coincidentes.
#Selecciona la restricción 'Coincidencia' y los dos puntos pasarán a ser coincidentes.
</div>


NOTE: In order to make two points coincident, FreeCAD must necessarily move one, or both, of the original points.
{{Emphasis|Note:}} In order to make two points coincident, FreeCAD must out of necessity move one (or both) of the original points.


== Alternatives to Coincident constraint ==
==Scripting==


The two constrained items of a [[Sketcher_ConstrainCoincident|Coincident]] constraint must be start point or end point vertices, or center points of arcs, circles or ellipses. Some combinations which are not possible with a coincident constraint can be emulated using other constraints:
===General scripting===
* The [[File:Sketcher_ConstrainSymmetric.svg|24px]] [[Sketcher_ConstrainSymmetric|Symmetric]] constraint can be used to place a start point, end point or center point on the midpoint of a straight line.
The constraint can be created from macros and from the python console by using the following command:
* A midpoint-to-midpoint placement of two straight lines can be achieved by creating a new [[File:Sketcher_CreatePoint.svg|24px]] [[Sketcher_CreatePoint|Point]] and using two [[File:Sketcher_ConstrainSymmetric.svg|24px]] [[Sketcher_ConstrainSymmetric|Symmetric]] constraints so that it lies on the midpoint of both lines.
{{Code|code=Sketch.addConstraint(Sketcher.Constraint('Coincident',LineFixed,PointOfLineFixed,LineMoving,PointOfLineMoving)) }}
* A vertex can be constrained to lie along an edge using a [[File:Sketcher_ConstrainPointOnObject.svg|24px]][[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. also before the start point or beyond the end point).
where :
* A collinear placement of two straight lines can be obtained by applying a [[File:Sketcher_ConstrainTangent.svg|24px]] [[Sketcher_ConstrainTangent|Tangent]] constraint to them, or by combining a [[File:Sketcher_ConstrainPointOnObject.svg|24px]] [[Sketcher_ConstrainPointOnObject|PointOnObject]] constraint and a [[File:Sketcher_ConstrainParallel.svg|24px]] [[Sketcher_ConstrainParallel|Parallel]] constraint.
*Sketch is a sketch object
* Two edges can be made identical by using two [[File:Sketcher_ConstrainCoincident.svg|24px]] [[Sketcher_ConstrainCoincident|Coincident]] constraints, one for each pair of extremities.
*LineFixed is the number of the line, that will not move by applying the constraint
* Two circles can be made identical by using a [[File:Sketcher_ConstrainCoincident.svg|24px]] [[Sketcher_ConstrainCoincident|Coincident]] constraint to merge the centers, and applying an [[File:Sketcher_ConstrainEqual.svg|24px]] [[Sketcher_ConstrainEqual|Equal]] constraint to their edges. For arcs, this will ensure both arcs are part of the same circle, while allowing them to have different start and end points.
*PointOfLineFixed is the number of the vertex of the line LineFixed that has to fulfilled the constraint
*LineMoving is the number of the line, that will move by applying the constraint
*PointOfLineMoving is the number of the line LineMoving, that has to fulfilled the constraint


==Scripting==
The main issue by using this function is to identify correctly the line number and the vertex number of the lines you want to process.


The constraint can be created from [[Macros|macros]] and from the [[Python|Python]] console by using the following command:
The next paragraph will explain you how to identify the numbering of a line and of a vertex of a line.


{{Code|code=Sketch.addConstraint(Sketcher.Constraint('Coincident',LineFixed,PointOfLineFixed,LineMoving,PointOfLineMoving)) }}
===Identifying the numbering of a line===


where :
I have drawn three lines as shown in the following figure.
* {{incode|Sketch}} is a sketch object

* {{incode|LineFixed}} is the number of the line, that will not move by applying the constraint
[[File:PartDesignConstraintPointOnPointScriptingFigure1.jpg|600px]]
* {{incode|PointOfLineFixed}} indicates which vertex of {{incode|LineFixed}} has to fulfill the constraint

* {{incode|LineMoving}} is the number of the line, that will move by applying the constraint
By moving the cursor of the mouse above the line you can see the line number at the bottom left of the FreeCAD windows, see next figure.
* {{incode|PointOfLineMoving}} indicates which vertex of {{incode|LineMoving}} has to fulfill the constraint

[[File:PartDesignConstraintPointOnPointScriptingFigure2.jpg|600px]]

Unfortunately the numbering displayed on the FreeCAD windows start from 1 whereas the numbering of the line used to script start from 0: this means that you have to retrieve one each time you want to refer to a line.

===Identifying the numbering of the vertices of a line===

The vertices of one line can only have the value 1 or 2. (Don’t ask me, why the vertices numbering does not start from 0 …) The vertices are numbered according to their order of creation. To find out the order of their creation (If you have a lot of lines, you cannot remember which vertex you have created first), you just have to move the cursor of your mouse above the two vertices of one line, see following figure.

[[File:PartDesignConstraintPointOnPointScriptingFigure3.jpg|600px]]

If you read e.g. 4 and 5, it means that the vertex 4 will be referenced by using the number 1 in the script command and the vertex 5 will be referenced by using the number 2 in the script command. Etc.

=== Example ===

Let us take the previous example of the three lines. The subsequent figure indicates the numbering of each line and their vertices according to the convention for scripting.

[[File:PartDesignConstraintPointOnPointScriptingFigure3Bis.jpg|600px]]

blue text = numbering of line, black text = numbering of vertices

The command
{{Code|code= Sketch.addConstraint(Sketcher.Constraint('Coincident',1,2,2,1)) }}
yields following result:


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.
[[File:PartDesignConstraintPointOnPointScriptingFigure4.jpg|600px]]


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 command
{{Code|code= Sketch.addConstraint(Sketcher.Constraint('Coincident',0,2,2,2)) }}
yields following result:


[[File:PartDesignConstraintPointOnPointScriptingFigure5.jpg|600px]]


<div class="mw-translate-fuzzy">
[[Category:Sketcher/es]]
</div>


{{Sketcher Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}
{{clear}}

Revision as of 23:06, 12 November 2021

Restricción de coincidencia

Ubicación en el Menú
Sketch → Restricciones de croquis → Restricción de coincidencia
Entornos de trabajo
Sketcher
Atajo de teclado por defecto
C
Introducido en versión
-
Ver también
Restricción de bloqueo, Punto en objeto

Description

"Crea una restricción de coincidencia en los objetos seleccionados"

Descripción

Esta restricción permite hacer dos puntos coincidentes.

This constraint tool takes two points as its argument and serves to make the two points coincident. (Meaning to make them as-one-point).

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

Utilización

  1. Selecciona dos puntos.
  2. Selecciona la restricción 'Coincidencia' y los dos puntos pasarán a ser coincidentes.

Note: In order to make two points coincident, FreeCAD must out of necessity move one (or both) of the original points.

Alternatives to Coincident constraint

The two constrained items of a Coincident constraint must be start point or end point vertices, or center points of arcs, circles or ellipses. Some combinations which are not possible with a coincident constraint can be emulated using other constraints:

  • The Symmetric constraint can be used to place a start point, end point or center point on the midpoint of a straight line.
  • A midpoint-to-midpoint placement of two straight lines can be achieved by creating a new Point and using two Symmetric constraints so that it lies on the midpoint of both lines.
  • A vertex can be constrained to lie along an edge using a PointOnObject constraint. Note that with this constraint, the point can lie anywhere on the full extension of a segment or curve (i.e. also before the start point or beyond the end point).
  • A collinear placement of two straight lines can be obtained by applying a Tangent constraint to them, or by combining a PointOnObject constraint and a Parallel constraint.
  • Two edges can be made identical by using two Coincident constraints, one for each pair of extremities.
  • Two circles can be made identical by using a Coincident constraint to merge the centers, and applying an Equal constraint to their edges. For arcs, this will ensure both arcs are part of the same circle, while allowing them to have different start and end points.

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.