Sketcher ConstrainCoincident/ro: Difference between revisions

From FreeCAD Documentation
(Updating to match new version of source page)
(Updating to match new version of source page)
Line 1: Line 1:
<languages/>
<languages/>

{{Docnav
{{Docnav
|[[Sketcher_ToggleConstruction|Construction Mode]]
|[[Sketcher_ToggleConstruction|Construction Mode]]
Line 47: Line 48:
</div>
</div>


== Alternatives to Coincident constraint ==
==Script==


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:
* 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.
* 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.
* 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).
* 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.
* Two edges can be made identical by using two [[File:Sketcher_ConstrainCoincident.svg|24px]] [[Sketcher ConstrainCoincident|Coincident]] constraints, one for each pair of extremities.
* 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.

<div class="mw-translate-fuzzy">
===General scripting===
===General scripting===
Constrângerea poate fi creată din macrocomenzi și din consola Python folosind următoarea comandă:
Constrângerea poate fi creată din macrocomenzi și din consola Python folosind următoarea comandă:
</div>

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

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

<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">
unde :
unde :
Line 61: Line 76:
</div>
</div>


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.
Problema principală prin utilizarea acestei funcții este de a identifica linia și numărul de linii pe care doriți să le procesați.


The [[Scripting 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.
Următorul paragraf vă va explica cum să identificați o linie și un vârf al unei linii.

===Identificați numărul liniei===

Am desenat trei linii, după cum se arată în figura următoare.

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

Deplasând cursorul mouse-ului peste linie se poate vedea numărul liniei în partea de jos a ferestrelor freeCAD, vedeți figura următoare.

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

Din nefericire, numerotarea afișată în ferestrele FreeCAD începe la 1, în timp ce numerotarea liniilor utilizate pentru script începe de la 0: aceasta înseamnă că trebuie să preluați unul de fiecare dată când doriți să vă referiți la o linie.

===Identificarea numărului vârfurilor unei linii===

<div class="mw-translate-fuzzy">
Vârfurile unei linii pot avea doar valoarea 1 sau 2. (Nu mă întrebați de ce nodurile nu încep de la 0 ...) Vârfurile sunt numerotate în funcție de ordinea lor de creare. Pentru a îi pune în ordinea în care au fost creați (dacă aveți mai multe linii , nu puteți să vă amintiți care vârf a fost creat primul), trebuie să glisați cursorul mouse-ului deasupra celor două vârfuri ale unei linii, vedeți în figura următoare.
</div>

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

Dacă ați citit de ex. 4 și 5, înseamnă că vârful 4 va fi refererențiat folosind numărul 1 din comanda script, iar vertexul 5 va fi referențiat folosind numărul 2 din comanda script. Etc.

=== Exemplu ===

Să luăm exemplul anterior al celor trei linii. Următoarea figură indică numerotarea fiecărei linii și vârfurile acesteia în conformitate cu convenția pentru scripting.

<div class="mw-translate-fuzzy">
[[File:PartDesignConstraintPointOnPointScriptingFigure3Bis.jpg|600px]]
</div>

<div class="mw-translate-fuzzy">
Comanda
</div>

<div class="mw-translate-fuzzy">
[[File:PartDesignConstraintPointOnPointScriptingFigure4.jpg|600px]]
</div>

<div class="mw-translate-fuzzy">
Comanda
</div>


[[Image:PartDesignConstraintPointOnPointScriptingFigure5.jpg|600px|center]]


<div class="mw-translate-fuzzy">
<div class="mw-translate-fuzzy">

Revision as of 19:20, 23 January 2021

Sketcher ConstrainCoincident

poziția meniului
Sketch → Sketcher constraints → Constrain coincident
Ateliere
Sketcher
scurtătură
C
Prezentat în versiune
-
A se vedea, de asemenea,
Constrain Lock, Constrain Point onto Object

Description

Descriere

Creați o constrângere de coincidență asupra elementului selectat

Acest instrument de constrângere ia două puncte ca argument pentru a face ca cele două puncte să coincident. (Însemnând să le faceți să devină ca un singur punct).

În termeni practici, acest instrument de constrângere este util atunci când există o ruptură într-un profil, de exemplu - unde două linii se termină aproape una de alta și trebuie să fie unite - o constrângere de coincidență asupra punctelor lor finale va închide spațiul.

Usage

Cum se folosește

După cum sa menționat mai sus, acest instrument are două argumente - ambele sunt puncte.

  1. În primul rând este necesar să evidențiem două puncte distincte. (Rețineți că acest lucru nu va funcționa dacă, de exemplu, doriți să selectați punctul inițial și cel final din aceeași linie).
  2. Evidențiarea unui element de desen este realizată prin mutarea mouse-ului peste element și făcând clic pe butonul stânga al mouse-ului.
  3. Un element selectat își va schimba culoarea în verde.
  4. Următoarele elemente pot fi evidențiate prin repetarea procedurilor de mai sus. NOTĂ: Nu este necesar să țineți apăsată o tastă specială, cum ar fi Ctrl, pentru a selecta mai multe elemente dintr-un desen.
  5. Odată ce ați selectat două puncte, faceți clic stânga pe 'PointOnPoint' constrângerea va face ca cele două puncte să devină coincident și să fie înlocuite de un singur punct.

NOTĂ: Pentru a face două puncte coincide, FreeCAD trebuie să se mute în mod necesar unul sau ambele puncte originale.

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.

General scripting

Constrângerea poate fi creată din macrocomenzi și din consola Python folosind următoarea comandă:

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

unde :

  • Sketch este un obiect sketch
  • LineFixed este numărul liniei care nu se mișcă prin aplicarea constrângerii
  • PointOfLineFixed este numărul liniei liniei Fixed care trebuie să îndeplinească constrângerea
  • LineMoving este numărul liniei care se va deplasa prin aplicarea constrângerii
  • PointOfLineMoving este numărul liniei este LineMoving, care trebuie să îndeplinească constrângerea

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 Scripting Sketcher constraints in Python 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.