--- /dev/null
+
+.. _tutorial:
+
+
+Tutorial
+========
+
+This exercise illustrates how to create screw-nut shape from scratch.
+
+
+Step1. Sketch.
+--------------
+
+At this step we will create a regular hexagon.
+
+- Create a :ref:`new-part` via Main Menu *Part - > New part*
+- Start :ref:`Sketch <sketchPlugin>` creation via Main Menu *Sketch - > Sketch*
+- Set **Size of the view** parameter equal to 250 in the Sketch dialog
+- Select **XOY** plane in the view
+- Click **Set plane view** button in the Sketch property panel
+
+.. image:: images/tutorial1_1.png
+ :align: center
+
+.. centered::
+ Skecth plane XOY
+- Start :ref:`Line <sketchLine>` creation via Main Menu *Sketch - > Line*
+- Pick 3 points in the view one by one and select the first one at the end to get a triangle:
+
+.. image:: images/tutorial1_2.png
+ :align: center
+
+.. centered::
+ 3 Lines forming a triangle
+- Hide trihedron via **Show/Hide trihedron** button in viewer toolbar
+- Select **Origin** object from **Part set / Constructions** folder in the object browser
+- Click on the eye icon on the left of the origin item to show it in the view
+- Select both origin and the bottom vertex of the triangle in the view (use **Shift** key for multi-selection)
+
+.. image:: images/tutorial1_3.png
+ :align: center
+
+.. centered::
+ Origin and triangle
+- Create :ref:`Coincident <sketchCoincident>` constraint via **Coincident** button in Sketch toolbar
+.. image:: images/tutorial1_4.png
+ :align: center
+
+.. centered::
+ Triangle vertex coincident with origin
+- Show trihedron
+- Select both **OY** axis and the upper side of the triangle in the view
+- Create :ref:`Perpendicular <sketchPerpendicular>` constraint via **Pependicular** button in Sketch toolbar
+.. image:: images/tutorial1_5.png
+ :align: center
+
+.. centered::
+ Upper triangle side perpendicular to OY axis
+- Select the left and the upper side of the triangle
+- Create :ref:`Equal <sketchEqual>` constraint via **Equal** button in Sketch toolbar
+- Make the upper and the right sides equal length in the same way
+.. image:: images/tutorial1_6.png
+ :align: center
+
+.. centered::
+ Equilateral triangle
+- Select the left side of the triangle
+- Check **Auxiliary** check box in the property panel and click **Apply** button
+.. image:: images/tutorial1_7.png
+ :align: center
+
+.. centered::
+ Line property panel
+- Make the right side auxiliary in the same way
+.. image:: images/tutorial1_8.png
+ :align: center
+
+.. centered::
+ The lateral sides are auxiliary
+- Start creation of :ref:`Angular copy <sketchAngularCopy>` feature via **Angular copy** button in Sketch toolbar
+- Select the upper side of the triangle for **Segments** parameter in the property panel
+- Select origin in the view as a center of rotation
+- Set **Total number** of objects equal to 6
+.. image:: images/tutorial1_9.png
+ :align: center
+
+.. centered::
+ Angular copy parameters
+- Click **Apply** button
+.. image:: images/tutorial1_10.png
+ :align: center
+
+.. centered::
+ Regular hexagon
+- Select the upper side of the hexagon
+- Start creation of :ref:`Length <sketchLength>` constraint via **Length** button in Sketch toolbar
+- Set length value equal to 115.4 and press **Enter**
+.. image:: images/tutorial1_11.png
+ :align: center
+
+.. centered::
+ Fully fixed regular hexagon
+- Click **Apply** button in the *Skecth* property panel to finish the sketch creation
+.. image:: images/tutorial1_12.png
+ :align: center
+
+.. centered::
+ Finished Sketch
+
+Step2. Polyline.
+----------------
+
+- Start :ref:`Point <constructionPoint>` creation via Main Menu *Construction - > Point*
+- Set x = 50, y = 0, z = 0
+.. image:: images/tutorial2_1.png
+ :align: center
+
+.. centered::
+ Construction of point (50, 0, 0)
+- Click **Apply** button to finish point creation
+- Create points (80, 0, 0), (112, 0, 13), (112, 0, 48), (80, 0, 63), (80, 0, 90), (50, 0, 90) in the same way
+- Select the created points in the object browser under **Part_1 / Constructions** node
+- Click right mouse button and select **Color...** item in the popup menu
+- Select blue color and click **OK** button
+.. image:: images/tutorial2_2.png
+ :align: center
+
+.. centered::
+ Points created from scratch
+- Start :ref:`Polyline <buildPolyline>` creation via Main Menu *Build - > Polyline*
+- Select all the 7 points (use **Shift** key for multi-selection)
+- Check **Closed** check box
+.. image:: images/tutorial2_3.png
+ :align: center
+
+.. centered::
+ Creation of closed polyline from 7 points
+- Click **Apply** button in the property panel
+.. image:: images/tutorial2_4.png
+ :align: center
+
+.. centered::
+ Closed Polyline
+
+Step3. Face.
+------------
+
+- Start :ref:`Face <buildFace>` creation via Main Menu *Build - > Face*
+- Select **Polyline_1_1** in the object browser under **Part_1 / Results** node
+.. image:: images/tutorial3_1.png
+ :align: center
+
+.. centered::
+ Construction of face from a polyline
+- Click **Apply** button in the property panel
+.. image:: images/tutorial3_2.png
+ :align: center
+
+.. centered::
+ Face
+
+Step4. Revolution.
+------------------
+
+- Start :ref:`Revolution <featureRevolution>` creation via Main Menu *Features - > Revolution*
+- Select the face created at step 3 in the view
+- Click on axis input field in the property panel and select **OZ** axis in the view
+.. image:: images/tutorial4_1.png
+ :align: center
+
+.. centered::
+ Revolution around OZ by 360 degrees
+- Click **Apply** button in the property panel
+.. image:: images/tutorial4_2.png
+ :align: center
+
+.. centered::
+ Solid created by rotation of face
+
+Step5. Extrusion.
+-----------------
+
+- Start :ref:`Extrusion <featureExtrusion>` creation via Main Menu *Features - > Extrusion*
+- Select the hexagon created at step 1
+- Click on axis input field in the property panel and select **OZ** axis in the view
+- Set **To size** parameter equal to 100
+.. image:: images/tutorial5_1.png
+ :align: center
+
+.. centered::
+ Extrusion along OZ axis from 0 to 100
+- Click **Apply** button in the property panel
+.. image:: images/tutorial5_2.png
+ :align: center
+
+.. centered::
+ Solid created by extrusion of sketch
+
+Step6. Common.
+--------------
+
+- Start :ref:`Common <featureCommon>` creation via Main Menu *Features - > Common*
+- Select the extrusion and the revolution in the object browser under **Part_1 / Results** node (use **Shift** key for multi-selection)
+.. image:: images/tutorial6_1.png
+ :align: center
+
+.. centered::
+ Common creation
+- Click **Apply** button in the property panel
+.. image:: images/tutorial6_2.png
+ :align: center
+
+.. centered::
+ The revolution and the extrusion common part
+
+Step7. Fillet.
+--------------
+
+- Start :ref:`Fillet <featureFillet>` creation via Main Menu *Features - > Fillet*
+- Select the edge
+.. image:: images/tutorial7_1.png
+ :align: center
+
+.. centered::
+ Select edge for a Fillet
+- Select **Radius** parameter equal to 10
+.. image:: images/tutorial7_2.png
+ :align: center
+
+.. centered::
+ Fillet with radius = 10
+- Click **Apply** button in the property panel
+.. image:: images/tutorial7_3.png
+ :align: center
+
+.. centered::
+ Fillet
+
+Step8. Box.
+-----------
+
+- Click right mouse button in the view and select **Hide all** item in the popup menu to clear the view
+- Start :ref:`Box <box_feature>` creation via Main Menu *Primitives - > Box*
+- Set **DX** = 10, **DY** = 120, **DZ** = 20
+.. image:: images/tutorial8_1.png
+ :align: center
+
+.. centered::
+ Box creation
+- Click **Apply** button in the property panel
+.. image:: images/tutorial8_2.png
+ :align: center
+
+.. centered::
+ Box
+
+Step9. Translation.
+-------------------
+
+- Start :ref:`Translation <featureTranslation>` creation via Main Menu *Part - > Translation*
+- Check **By X, Y and Z dimensions** option on the top of the property panel
+- Select the box in the view
+- Set **DX** = -10, **DY** = 20, **DZ** = 70
+.. image:: images/tutorial9_1.png
+ :align: center
+
+.. centered::
+ Box translation
+- Click **Apply** button in the property panel
+.. image:: images/tutorial9_2.png
+ :align: center
+
+.. centered::
+ Translated Box
+
+Step10. Angular Copy.
+---------------------
+
+- Start :ref:`Angular Copy <featureAngularCopy>` creation via Main Menu *Part - > Angular Copy*
+- Select the box in the view
+- Click on axis input field in the property panel and select **OZ** axis in the view
+- Set **Nb copies** parameter equal to 6
+.. image:: images/tutorial10_1.png
+ :align: center
+
+.. centered::
+ Angular Copy around OZ
+- Click **Apply** button in the property panel
+.. image:: images/tutorial10_2.png
+ :align: center
+
+.. centered::
+ Copied Box
+
+Step11. Cut.
+------------
+
+- Select **Fillet_1_1** item in the object browser under **Part_1 / Results** node
+- Click on the eye icon on the left of the result item to show it in the view
+- Start :ref:`Cut <featureCut>` creation via Main Menu *Features - > Cut*
+- Select the fillet object in the view as a main object
+- Select the angular copy object in the object browser as a tool object
+.. image:: images/tutorial11_1.png
+ :align: center
+
+.. centered::
+ Cut creation
+- Click **Apply** button in the property panel
+- Select the created **Cut_1_1** item in the object browser under **Part_1 / Results** node
+- Click right mouse button and select **Color...** item in the popup menu
+- Set (R: 255, G: 214, B: 0) color and click **OK** button
+
+.. image:: images/tutorial11_2.png
+ :align: center
+
+.. centered::
+ Cut
+
+
+**See Also** a :ref:`TUI Script <tui_tutorial>` reproducing all the tutorial steps.
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+
+# Step1. Sketch.
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-57.7, 99.93933159672423, 57.7, 99.93933159672423)
+SketchLine_2 = Sketch_1.addLine(57.7, 99.93933159672423, 0, 0)
+SketchLine_2.setAuxiliary(True)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(0, 0, -57.7, 99.93933159672423)
+SketchLine_3.setAuxiliary(True)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_4 = SketchProjection_2.createdFeature()
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_1.result())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result())
+SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result())
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Line(SketchLine_4).startPoint(), 360, 6, True)
+[SketchLine_5, SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9] = SketchMultiRotation_1.rotated()
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 115.4)
+model.do()
+
+# Step2. Polyline.
+Point_2 = model.addPoint(Part_1_doc, 50, 0, 0)
+Point_2.result().setColor(0, 0, 255)
+Point_3 = model.addPoint(Part_1_doc, 80, 0, 0)
+Point_3.result().setColor(0, 0, 255)
+Point_4 = model.addPoint(Part_1_doc, 112, 0, 13)
+Point_4.result().setColor(0, 0, 255)
+Point_5 = model.addPoint(Part_1_doc, 112, 0, 48)
+Point_5.result().setColor(0, 0, 255)
+Point_6 = model.addPoint(Part_1_doc, 80, 0, 63)
+Point_6.result().setColor(0, 0, 255)
+Point_7 = model.addPoint(Part_1_doc, 80, 0, 90)
+Point_7.result().setColor(0, 0, 255)
+Point_8 = model.addPoint(Part_1_doc, 50, 0, 90)
+Point_8.result().setColor(0, 0, 255)
+
+Polyline_1_objects = [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"),
+ model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4"),
+ model.selection("VERTEX", "Point_5"), model.selection("VERTEX", "Point_6"),
+ model.selection("VERTEX", "Point_7")]
+Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, True)
+
+# Step3. Face.
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Polyline_1_1")])
+
+# Step4. Revolution.
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+
+# Step5. Extrusion.
+Wire_Name = "Sketch_1/Wire-SketchLine_1r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r"
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", Wire_Name)], model.selection("EDGE", "PartSet/OZ"), 100, 0)
+
+# Step6. Common.
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Revolution_1_1"), model.selection("SOLID", "Extrusion_1_1")])
+
+# Step7. Fillet.
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Common_1_1/Modified_Face_10")], 10)
+
+# Step8. Box.
+Box_1 = model.addBox(Part_1_doc, 20, 120, 20)
+
+# Step9. Translation.
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], -10, 20, 70)
+
+# Step10. Angular Copy.
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), 6)
+
+# Step11. Cut.
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fillet_1_1")], [model.selection("COMPOUND", "AngularCopy_1_1")])
+Cut_1.result().setColor(255, 214, 0)
+
+model.do()
+model.end()