Sketch objects
--------------
-The plug-in includes following features for creation of 2D objects:
+The plug-in includes the following features for creation of 2D objects:
.. toctree::
:maxdepth: 1
Constraints
-----------
+Constraints are available and viewable during sketch creation or editing.
+The goal of constrains creation is to fix a sketch geometry, i.e. set degrees of freedom to zero.
+
+If all degrees of freedom are eliminated, the sketch is fixed and displayed with green color.
+
+.. image:: images/Sketch_fixed.png
+ :align: center
+
+.. centered::
+ Fixed Sketch
+
+If any degrees of freedom remain unsolved, the sketch is under-constrained and displayed with red color.
+
+.. image:: images/Sketch_underconstrained.png
+ :align: center
+
+.. centered::
+ Underconstrained Sketch
+
+The plug-in includes the following constraints:
.. toctree::
:maxdepth: 1
distanceFeature.rst
horizontalDistFeature.rst
+ verticalDistFeature.rst
angleFeature.rst
coincedenceFeature.rst
collinearFeature.rst
radiusFeature.rst
rigidFeature.rst
tangentFeature.rst
- verticalDistFeature.rst
verticalFeature.rst
.. _sketch_operations:
--- /dev/null
+
+ .. _tui_create_distance:
+
+Create Distance constraint
+==========================
+
+.. literalinclude:: examples/distance.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/distance.py>`
--- /dev/null
+
+ .. _tui_create_hdistance:
+
+Create Horizontal Distance constraint
+=====================================
+
+.. literalinclude:: examples/hdistance.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/hdistance.py>`
--- /dev/null
+
+ .. _tui_create_vdistance:
+
+Create Vertical Distance constraint
+=====================================
+
+.. literalinclude:: examples/vdistance.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/vdistance.py>`
Distance constraint
===================
+Distance can be defined between two objects such as point, line, line or arc end point, center of circle or arc.
-.. image:: images/Distance.png
- :align: center
+To create Distance constraint in the active Sketch:
+
+#. select in the Main Menu *Sketch - > Distance* item or
+#. click **Distance** button in Sketch toolbar:
+
+.. image:: images/distance.png
+ :align: center
+
+.. centered::
+ **Distance** button
+
+Property panel:
+
+.. image:: images/Distance_panel.png
+ :align: center
+
+Input fields:
+
+- **First object** - the first object
+- **Second object** - the second object
+- **Value** - distance between the objects, could be modified to set the desirable value
+- **Text location** - position of the distance value label relating to extension line (in the view)
+ .. image:: images/location_left.png
+ :align: left
+ **Left** inserts text at the left of the distance extension line.
+
+ .. image:: images/location_automatic.png
+ :align: left
+ **Automatic** inserts text at the middle of the distance extension line if it has enough length, otherwise - to the left.
+
+ .. image:: images/location_right.png
+ :align: left
+ **Right** inserts text to the right of the distance extension line.
+- **Keep orientation** - fixes the relative position between selected objects
+
+When the both objects are selected distance value is displayed in the property panel and in the view.
+
+When creating the constraint and the both objects are selected the first time:
+
+- drag the distance presentation in the view to the desired position (by move mouse and click once)
+- set desirable distance value in the input field in the view and press **Enter** or just press **Enter** to keep the current distance
+
+.. image:: images/Distance_field_view.png
+ :align: center
.. centered::
- Create a distance constraint
+ Distance input in the view
+
+**TUI Command**: *Sketch_1.setDistance(FirstObject, SecondObject, Value, KeepOrientation)*
+
+**Arguments**: 2 objects + distance value + keep orientation flag
+
+Result
+""""""
+
+Created Distance appears in the view.
+
+.. image:: images/Distance_res.png
+ :align: center
+
+.. centered::
+ Distance created
+
+**See Also** a sample TUI Script of a :ref:`tui_create_distance` operation.
--- /dev/null
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(24.1, 24.5, 18.2)
+SketchLine_1 = Sketch_1.addLine(54.3, 93.4, 91.2, 56.4)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 70.0, True)
+model.do()
+model.end()
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(24.1, 24.5, 18.2)
+SketchLine_1 = Sketch_1.addLine(54.3, 93.4, 91.2, 56.4)
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchLine_1.startPoint(), 30)
+model.do()
+model.end()
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(24.1, 24.5, 18.2)
+SketchLine_1 = Sketch_1.addLine(62.3, 85.1, 91.2, 56.4)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchCircle_1.center(), SketchLine_1.startPoint(), 75.5)
+model.do()
+model.end()
\ No newline at end of file
Horizontal distance constraint
==============================
+Horizontal Distance constraint fixes distance between two objects along the horizontal axis.
-.. image:: images/HorizontalDist.png
- :align: center
+The constraint can be defined between two points such as point object, line or arc end point, center of circle or arc.
+
+To create Horizontal Distance constraint in the active Sketch:
+
+#. select in the Main Menu *Sketch - > Horizontal Distance* item or
+#. click **Horizontal Distance** button in Sketch toolbar:
+
+.. image:: images/distance_h.png
+ :align: center
.. centered::
- Create horizontal distance constraint
+ **Horizontal Distance** button
+
+Property panel:
+
+.. image:: images/HorizontalDistance_panel.png
+ :align: center
+
+Input fields:
+
+- **First object** - the first object
+- **Second object** - the second object
+- **Value** - distance between the objects, could be modified to set the desirable value
+- **Text location** - position of the distance value label relating to extension line (in the view)
+ .. image:: images/location_left.png
+ :align: left
+ **Left** inserts text at the left of the distance extension line.
+
+ .. image:: images/location_automatic.png
+ :align: left
+ **Automatic** inserts text at the middle of the distance extension line if it has enough length, otherwise - to the left.
+
+ .. image:: images/location_right.png
+ :align: left
+ **Right** inserts text to the right of the distance extension line.
+
+When the both objects are selected horizontal distance value is displayed in the property panel and in the view.
+
+When creating the constraint and the both objects are selected the first time:
+
+- drag the horizontal distance presentation in the view to the desired position (by move mouse and click once)
+- set desirable horizontal distance value in the input field in the view and press **Enter** or just press **Enter** to keep the current distance
+
+.. image:: images/HorizontalDistance_field_view.png
+ :align: center
+
+.. centered::
+ Horizontal Distance input in the view
+
+**TUI Command**: *Sketch_1.setHorizontalDistance(FirstObject, SecondObject, Value)*
+
+**Arguments**: 2 objects + horizontal distance value
+
+Result
+""""""
+
+Created Horizontal Distance appears in the view.
+
+.. image:: images/HorizontalDistance_res.png
+ :align: center
+
+.. centered::
+ Horizontal Distance created
+
+**See Also** a sample TUI Script of a :ref:`tui_create_hdistance` operation.
\ No newline at end of file
Vertical distance constraint
============================
+Vertical Distance constraint fixes distance between two objects along the vertical axis.
-.. image:: images/VerticalDist.png
- :align: center
+The constraint can be defined between two points such as point object, line or arc end point, center of circle or arc.
+
+To create Vertical Distance constraint in the active Sketch:
+
+#. select in the Main Menu *Sketch - > Vertical Distance* item or
+#. click **Vertical Distance** button in Sketch toolbar:
+
+.. image:: images/distance_v.png
+ :align: center
.. centered::
- Create a vertical distance constraint
+ **Vertical Distance** button
+
+Property panel:
+
+.. image:: images/VerticalDistance_panel.png
+ :align: center
+
+Input fields:
+
+- **First object** - the first object
+- **Second object** - the second object
+- **Value** - distance between the objects, could be modified to set the desirable value
+- **Text location** - position of the distance value label relating to extension line (in the view)
+ .. image:: images/location_left.png
+ :align: left
+ **Left** inserts text at the left of the distance extension line.
+
+ .. image:: images/location_automatic.png
+ :align: left
+ **Automatic** inserts text at the middle of the distance extension line if it has enough length, otherwise - to the left.
+
+ .. image:: images/location_right.png
+ :align: left
+ **Right** inserts text to the right of the distance extension line.
+
+When the both objects are selected vertical distance value is displayed in the property panel and in the view.
+
+When creating the constraint and the both objects are selected the first time:
+
+- drag the Vertical distance presentation in the view to the desired position (by move mouse and click once)
+- set desirable vertical distance value in the input field in the view and press **Enter** or just press **Enter** to keep the current distance
+
+.. image:: images/VerticalDistance_field_view.png
+ :align: center
+
+.. centered::
+ Vertical Distance input in the view
+
+**TUI Command**: *Sketch_1.setVerticalDistance(FirstObject, SecondObject, Value)*
+
+**Arguments**: 2 objects + vertical distance value
+
+Result
+""""""
+
+Created Vertical Distance appears in the view.
+
+.. image:: images/VerticalDistance_res.png
+ :align: center
+
+.. centered::
+ Vertical Distance created
+
+**See Also** a sample TUI Script of a :ref:`tui_create_vdistance` operation.