Sketch plug-in
================
+Sketch plug-in includes features for creation of 2D shapes.
-.. image:: images/StartSketch.png
- :align: center
+The process of sketch creation is comprised of:
+- definition of sketch plane
+- creation of sketch objects from scratch
+- generation of sketch objects via operations on the existing operations
+- definition of constaints
+
+Sketch could be created both in active part and a part set (if there is no active part).
+
+To create a Sketch:
+
+#. select in the Main Menu *Sketch - > Sketch* item or
+#. click **Sketch** button in Sketch toolbar:
+
+.. image:: images/SketchButton.png
+ :align: center
.. centered::
- Start sketcher
+ **Sketch** button
+
+At first it is necessary to define a plane on which to create a sketch:
+
+.. image:: images/PlaneDefinition.png
+ :align: center
+
+- specify plane size (equal to 25 in the example above)
+- then select the appropriate plane in the viewer
+
+Note that in case if there are no convenient objects for plane selection are
+displayed in the viewer - coordinate planes will be suggested for selection:
+.. image:: images/CoordinatePlanes.png
+ :align: center
+After the plane for sketch is selected the following property panel will be opened:
-.. image:: images/SketchProperties.png
- :align: center
+.. image:: images/SketchPanel.png
+ :align: center
.. centered::
- Sketcher properies panel
+ Sketch general panel
+- **Reversed** check box - allows reversing the sketch plane normal
+- **Set plane view** button - switches the viewer to the top view for the sketch plane
+- **Show geometrical constraints** check box - turns on/off geometrical constraints displaying
+- **Show dimensional constraints** check box - turns on/off dimensional constraints displaying
+- **Show existing expressions** check box - turns on/off expressions displaying
+
+Now it is possible to create sketch objects, make sketch operations and constraints.
+To apply or cancel sketch creation it is possible to use apply and cancel buttons from the
+Sketch panel as well as equivalent buttons from Sketch toolbar.
+
+The Result of operation will be a COMPOUND. Result node in the object tree is located in
+**Constructions** folder.
+
+Name is assigned automatically: **Sketch_1**, **Sketch_2**, ... both for Feature and Result.
+
+**TUI Command**: *Sketch_1 = model.addSketch(PartOrPartSet, plane)*
+
+**Arguments**: Part or PartSet + plane.
Sketch objects
--------------
+The plug-in includes following features for creation of 2D objects:
+
.. toctree::
:maxdepth: 1
- arcFeature.rst
- circleFeature.rst
- ellipseFeature.rst
- lineFeature.rst
pointFeature.rst
+ lineFeature.rst
+ rectangleFeature.rst
+ circleFeature.rst
+ arcFeature.rst
Constraints
-----------
+
+
.. toctree::
:maxdepth: 1
+ distanceFeature.rst
+ horizontalDistFeature.rst
angleFeature.rst
coincedenceFeature.rst
collinearFeature.rst
- distanceFeature.rst
equalFeature.rst
- horizontalDistFeature.rst
horizontalFeature.rst
lengthFeature.rst
middleFeature.rst
:maxdepth: 1
filletFeature.rst
+ splitFeature.rst
+ trimFeature.rst
intersectionFeature.rst
mirrorFeature.rst
projectionFeature.rst
rotationFeature.rst
- splitFeature.rst
translationFeature.rst
- trimFeature.rst
--- /dev/null
+
+ .. _tui_create_line:
+
+Create Skecth Line
+==================
+
+.. literalinclude:: examples/line.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/line.py>`
--- /dev/null
+
+ .. _tui_create_point:
+
+Create Skecth Point
+===================
+
+.. literalinclude:: examples/point.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/point.py>`
--- /dev/null
+
+ .. _tui_create_rectangle:
+
+Create Skecth Rectangle
+=======================
+
+.. literalinclude:: examples/rectangle.py
+ :linenos:
+ :language: python
+
+:download:`Download this script <examples/rectangle.py>`
Arc
===
+The feature Arc creates an arc segment in the current Sketch.
-.. image:: images/Arc1.png
- :align: center
+To add new Arc to the Sketch:
+
+#. select in the Main Menu *Sketch - > Arc* item or
+#. click **Arc** button in Sketch toolbar:
+
+.. image:: images/arc.png
+ :align: center
.. centered::
- Create arc by center and two points
+ **Arc** button
+There are 3 algorithms for creation of an Arc:
-.. image:: images/Arc2.png
- :align: center
+.. image:: images/arc_base_32x32.png
+ :align: left
+**By center and two points** creates an arc segment with the given center passing from the start point to the end point on the circumference.
-.. centered::
- Create arc by three points
+.. image:: images/arc_3pt_32x32.png
+ :align: left
+**By three points** creates an arc segment passing from the start point to end point through another point on the circumference.
+.. image:: images/arc_tang_32x32.png
+ :align: left
+**By tangent and point** creates an arc segment with the tangent point and the end point.
-.. image:: images/Arc3.png
- :align: center
+By center and two points
+""""""""""""""""""""""""
-.. centered::
- Create arc as tangent to an edge
+.. image:: images/Arc_panel_base.png
+ :align: center
+
+
+
+**TUI Command**: *Sketch_1.addCircle(CenterX, CenterY, StartX, StartY, EndX, EndY, Inversed)*
+
+**Arguments**: 7 values (coordinates of the center, the start, the end, inversed flag (if true - build arc from end to start)).
+
+By three points
+"""""""""""""""
+
+.. image:: images/Arc_panel_3pt.png
+ :align: center
+
+**TUI Command**: *Sketch_1.addCircle(StartX, StartY, EndX, EndY, PassedX, PassedY)*
+
+**Arguments**: 6 values (coordinates of the start, end and passed points).
+
+By tangent and point
+""""""""""""""""""""
+
+.. image:: images/Arc_panel_tang.png
+ :align: center
+
+**TUI Command**: *Sketch_1.addCircle(TangetPoint, EndX, EndY, Inversed)*
+
+**Arguments**: 4 values (reference to tangent point, coordinates of end point, inversed flag (if true - build arc from end to start)).
\ No newline at end of file
Circle
======
+The feature Circle creates a circle in the current Sketch.
-.. image:: images/Circle1.png
- :align: center
+To add new Circle to the Sketch:
+
+#. select in the Main Menu *Sketch - > Circle* item or
+#. click **Circle** button in Sketch toolbar:
+
+.. image:: images/circle.png
+ :align: center
.. centered::
- Create circle by center and point
+ **Circle** button
+There are 2 algorithms for creation of a Circle:
-.. image:: images/Circle2.png
- :align: center
+.. image:: images/circle_pt_rad_32x32.png
+ :align: left
+**By center and passed point** creates a circle with the given center passing through the given point.
-.. centered::
- Create circle by tree points
+.. image:: images/circle_3pt_32x32.png
+ :align: left
+**By three points** creates a circle passing through the given three points.
+
+By center and passed point
+""""""""""""""""""""""""""
+
+.. image:: images/Circle_panel_pt_rad.png
+ :align: center
+
+Click in the view once to set the center point, then move the mouse and click a second time to set the passed point.
+
+**TUI Command**: *Sketch_1.addCircle(CenterX, CenterY, PassedX, PassedY)*
+
+**Arguments**: 4 values (coordinates of the center and the passed point).
+
+By three points
+"""""""""""""""
+
+.. image:: images/Circle_panel_3pt.png
+ :align: center
+
+Click in the view once to set the first passed point, then move the mouse and click a second time to set the second passed point
+and finally move the mouse and click a third time to set the last passed point.
+
+**TUI Command**: *Sketch_1.addCircle(X1, Y1, X2, Y2, X3, Y3)*
+
+**Arguments**: 6 values (coordinates of three points).
--- /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"))
+SketchLine_1 = Sketch_1.addLine(64.50309529234383, 87.92795791556755, -33.49721981216553, -42.5840914148601)
+model.do()
+model.end()
--- /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"))
+SketchPoint_1 = Sketch_1.addPoint(42.64092753227449, 19.02972704799864)
+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"))
+Rectangle_1 = Sketch_1.addRectangle(5.598878525298213, 8.556502484736781, 31.35634838639225, 78.97905438572354)
+model.do()
+model.end()
Line
====
+The feature Line creates a line segment by two points in the current Sketch.
-.. image:: images/Line.png
+To add new Line to the Sketch:
+
+#. select in the Main Menu *Sketch - > Line* item or
+#. click **Line** button in Sketch toolbar:
+
+.. image:: images/line.png
+ :align: center
+
+.. centered::
+ **Line** button
+
+The following property panel appears.
+
+.. image:: images/Line_panel.png
:align: center
.. centered::
- Create a line
+ Line
+
+Pick 2 points (start and end) in the view to create a Line. In the case of click on an existing object constraint for
+the point will be created automatically.
+
+Start and end points coordinates are displayed in the property panel.
+
+**TUI Command**: *Sketch_1.addLine(X1, Y1, X2, Y2)*
+
+**Arguments**: 4 values (coordinates of the start and end points).
+
+Result
+""""""
+
+Created line appears in the view.
+
+Example is shown below.
+
+.. image:: images/Line_res.png
+ :align: center
+
+.. centered::
+ Line created
+
+**See Also** a sample TUI Script of a :ref:`tui_create_line` operation.
Point
=====
+The feature Point creates a point in the current Sketch.
-.. image:: images/Point.png
+To add new Point to the Sketch:
+
+#. select in the Main Menu *Sketch - > Point* item or
+#. click **Point** button in Sketch toolbar:
+
+.. image:: images/point.png
+ :align: center
+
+.. centered::
+ **Point** button
+
+The following property panel appears.
+
+.. image:: images/Point_panel.png
:align: center
.. centered::
- Create a point
+ Point
+
+Clicking in the view creates a point preview. In the case of click on an existing object constraint for
+the point will be created automatically.
+
+The point coordinates are displayed in the property panel.
+
+**TUI Command**: *Sketch_1.addPoint(X, Y)*
+
+**Arguments**: 2 values (coordinates on the Sketch plane).
+
+Result
+""""""
+
+Created point appears in the view.
+
+Example is shown below.
+
+.. image:: images/Point_res.png
+ :align: center
+
+.. centered::
+ Point created
+
+**See Also** a sample TUI Script of a :ref:`tui_create_point` operation.
\ No newline at end of file
Rectangle
=========
+The feature Rectangle creates a rectangle by two opposite points in the current Sketch.
-.. image:: images/Rectangle.png
+The result is represented in the form of four Lines which compose a rectangle.
+Two of the lines have Vertical constraint and two others have Horizontal constraint.
+
+To add new Rectangle to the Sketch:
+
+#. select in the Main Menu *Sketch - > Rectangle* item or
+#. click **Rectangle** button in Sketch toolbar:
+
+.. image:: images/rectangle.png
+ :align: center
+
+.. centered::
+ **Rectangle** button
+
+The following property panel appears.
+
+.. image:: images/Rectangle_panel.png
:align: center
.. centered::
- Create a rectangle
+ Rectangle
+
+Click in the view once to set the first corner, then move the mouse and click a second time to set the opposite corner.
+In the case of click on an existing object constraint for the point will be created automatically.
+
+Start and end points coordinates are displayed in the property panel.
+
+**TUI Command**: *Sketch_1.addRectangle(X1, Y1, X2, Y2)*
+
+**Arguments**: 4 values (coordinates of the start and end points).
+
+Result
+""""""
+
+Created rectangle appears in the view.
+
+Example is shown below.
+
+.. image:: images/Rectangle_res.png
+ :align: center
+
+.. centered::
+ Rectangle created
+
+**See Also** a sample TUI Script of a :ref:`tui_create_rectangle` operation.
\ No newline at end of file