]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Add parameters creation to the tutorial.
authormzn <mzn@opencascade.com>
Mon, 1 Oct 2018 11:07:58 +0000 (14:07 +0300)
committermzn <mzn@opencascade.com>
Mon, 1 Oct 2018 11:10:21 +0000 (14:10 +0300)
doc/gui/Tutorial.rst
doc/gui/examples/tutorial.py
doc/gui/images/tutorial1_11.png
doc/gui/images/tutorial1_13.png [new file with mode: 0644]
doc/gui/images/tutorial2_0.png [new file with mode: 0644]
doc/gui/images/tutorial5_1.png
doc/gui/images/tutorial5_2.png

index 679b432f1a41dd971d6af2f60785a4d35badf520..f3aba125b08f39888f40e3b851f90b42e06d4ae6 100644 (file)
@@ -94,7 +94,7 @@ At this step we will create a regular hexagon.
    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**
+- Set length expression equal to "a=115.4" and press **Enter**
 .. image:: images/tutorial1_11.png
    :align: center
 
@@ -106,10 +106,24 @@ At this step we will create a regular hexagon.
 
 .. centered::
    Finished Sketch
+- Check item corresponding to the created parameter **a** under **Part_1 / Parameters** node
+.. image:: images/tutorial1_13.png
+   :align: center
+
+.. centered::
+   Parameter created during the Sketch operation
 
 Step2. Polyline.
 ----------------
 
+- Start :ref:`Parameter <parameter>` creation via Main Menu *Part - > Parameter*
+- Set parameter name = "h", set parameter expression = "90", set comment = "nut height"
+.. image:: images/tutorial2_0.png
+   :align: center
+
+.. centered::
+   Creation of parameter h = 90
+- Click **Apply** button to finish parameter creation
 - Start :ref:`Point <constructionPoint>` creation via Main Menu *Construction - > Point*
 - Set x = 50, y = 0, z = 0
 .. image:: images/tutorial2_1.png
@@ -118,7 +132,7 @@ Step2. Polyline.
 .. 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
+- Create points (80, 0, 0), (112, 0, 13), (112, 0, 48), (80, 0, 63), (80, 0, h), (50, 0, h) 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
@@ -183,12 +197,14 @@ 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
+- Check **By bounding planes and offsets option**
+- Select the bottom face of the revolution shape as **From** plane
+- Select the top face of the revolution shape as **To** plane
 .. image:: images/tutorial5_1.png
    :align: center
 
 .. centered::
-   Extrusion along OZ axis from 0 to 100
+   Extrusion along OZ axis by bounding planes
 - Click **Apply** button in the property panel
 .. image:: images/tutorial5_2.png
    :align: center
index d6519c9ea0a99ce390dfd58c01f63a1dccda885c..64e0c404e5fddd1c82b72124d4280db17e1332b0 100644 (file)
@@ -9,13 +9,17 @@ partSet = model.moduleDocument()
 Part_1 = model.addPart(partSet)
 Part_1_doc = Part_1.document()
 
+# Parameters
+model.addParameter(Part_1_doc, "h", "90", "nut height")
+model.addParameter(Part_1_doc, "a", "115.4")
+
 # 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_1 = Sketch_1.addLine(-57.69999999999999, 99.93933159672423, 57.70000000000001, 99.93933159672423)
+SketchLine_2 = Sketch_1.addLine(57.70000000000001, 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 = Sketch_1.addLine(0, 0, -57.69999999999999, 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())
@@ -29,7 +33,7 @@ SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.
 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)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "a")
 model.do()
 
 # Step2. Polyline.
@@ -43,11 +47,10 @@ 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 = model.addPoint(Part_1_doc, "80", "0", "h")
 Point_7.result().setColor(0, 0, 255)
-Point_8 = model.addPoint(Part_1_doc, 50, 0, 90)
+Point_8 = model.addPoint(Part_1_doc, "50", "0", "h")
 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"),
@@ -61,14 +64,17 @@ Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Polyline_1_1")])
 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)
+Wire = model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r")
+To = model.selection("FACE", "Revolution_1_1/Generated_Face_6")
+From = model.selection("FACE", "Revolution_1_1/Generated_Face_1")
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [Wire], model.selection("EDGE", "PartSet/OZ"), To, 0, From, 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)
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Common_1_1/Modified_Face_11")], 10)
 
 # Step8. Box.
 Box_1 = model.addBox(Part_1_doc, 20, 120, 20)
index 2333c293af9ca4094a9d3ee0a1bdf4d07d3a1f9f..791988d8971f1fb7993346150f048e11ed19c70c 100644 (file)
Binary files a/doc/gui/images/tutorial1_11.png and b/doc/gui/images/tutorial1_11.png differ
diff --git a/doc/gui/images/tutorial1_13.png b/doc/gui/images/tutorial1_13.png
new file mode 100644 (file)
index 0000000..c3eef14
Binary files /dev/null and b/doc/gui/images/tutorial1_13.png differ
diff --git a/doc/gui/images/tutorial2_0.png b/doc/gui/images/tutorial2_0.png
new file mode 100644 (file)
index 0000000..02599a9
Binary files /dev/null and b/doc/gui/images/tutorial2_0.png differ
index 7975c6c27034988ab00a10a6894ee1e5fa9a4d5c..94fe6fa2e5cb0d10bd49e1a804f4c15e70f8fdb7 100644 (file)
Binary files a/doc/gui/images/tutorial5_1.png and b/doc/gui/images/tutorial5_1.png differ
index 9fc088869800e1120a29ee92829eed6ccd9e368e..0ab880abc588d902adb5d4b7c0712536935de2fd 100644 (file)
Binary files a/doc/gui/images/tutorial5_2.png and b/doc/gui/images/tutorial5_2.png differ