From: gzy Date: Fri, 21 Sep 2018 13:41:21 +0000 (+0300) Subject: translation and rotation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b8875f79d4aa70bf16764a3158cf4466a93d3c7a;p=modules%2Fshaper.git translation and rotation --- diff --git a/src/FeaturesPlugin/doc/TUI_rotation3pointsFeature.rst b/src/FeaturesPlugin/doc/TUI_rotation3pointsFeature.rst new file mode 100644 index 000000000..b6af697ee --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_rotation3pointsFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_rotation_3points: + +Rotation by center and points +============================= + +.. literalinclude:: examples/rotation2.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_rotationaxisFeature.rst b/src/FeaturesPlugin/doc/TUI_rotationaxisFeature.rst new file mode 100644 index 000000000..de089c14d --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_rotationaxisFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_rotation_axis: + +Rotation by axis and angle +========================== + +.. literalinclude:: examples/rotation1.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_translation2pointsFeature.rst b/src/FeaturesPlugin/doc/TUI_translation2pointsFeature.rst new file mode 100644 index 000000000..b26f8e762 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_translation2pointsFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_translation_2points: + +Translation by 2 points +======================= + +.. literalinclude:: examples/translation2points.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_translationdxdydzFeature.rst b/src/FeaturesPlugin/doc/TUI_translationdxdydzFeature.rst new file mode 100644 index 000000000..e3e273ce8 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_translationdxdydzFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_translation_DXDYDZ: + +Translation by vector +===================== + +.. literalinclude:: examples/translationDXDYDZ.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_translationvectorFeature.rst b/src/FeaturesPlugin/doc/TUI_translationvectorFeature.rst new file mode 100644 index 000000000..70278fa9f --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_translationvectorFeature.rst @@ -0,0 +1,12 @@ + + .. _tui_translation_vector: + +Translation by axis and distance +================================ + +.. literalinclude:: examples/translationvector.py + :linenos: + :language: python + +:download:`Download this script ` + diff --git a/src/FeaturesPlugin/doc/examples/rotation1.py b/src/FeaturesPlugin/doc/examples/rotation1.py new file mode 100644 index 000000000..a82d443bb --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/rotation1.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Cone_1")], model.selection("EDGE", "PartSet/OX"), 120) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/rotation2.py b/src/FeaturesPlugin/doc/examples/rotation2.py new file mode 100644 index 000000000..489541f93 --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/rotation2.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Cone_1_1/Face_1&Cone_1_1/Face_3"), model.selection("VERTEX", "Cone_1_1/Face_1&Cone_1_1/Face_2")) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/translation2points.py b/src/FeaturesPlugin/doc/examples/translation2points.py new file mode 100644 index 000000000..d06a7ecad --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/translation2points.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("VERTEX", "PartSet/Origin"), model.selection("VERTEX", "Cone_1_1/Face_1&Cone_1_1/Face_2")) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/translationDXDYDZ.py b/src/FeaturesPlugin/doc/examples/translationDXDYDZ.py new file mode 100644 index 000000000..d06cf3bcf --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/translationDXDYDZ.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], 10, 20, 50) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/translationvector.py b/src/FeaturesPlugin/doc/examples/translationvector.py new file mode 100644 index 000000000..5ebee45fa --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/translationvector.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10) +Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "Cone_1_1/Face_1"), 40) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/images/rotation.png b/src/FeaturesPlugin/doc/images/rotation.png new file mode 100644 index 000000000..cfc31b4ab Binary files /dev/null and b/src/FeaturesPlugin/doc/images/rotation.png differ diff --git a/src/FeaturesPlugin/doc/images/rotation_3pt_32x32.png b/src/FeaturesPlugin/doc/images/rotation_3pt_32x32.png new file mode 100644 index 000000000..e2493da05 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/rotation_3pt_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/rotation_axis_32x32.png b/src/FeaturesPlugin/doc/images/rotation_axis_32x32.png new file mode 100644 index 000000000..cf443b372 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/rotation_axis_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/translation_2pt_32x32.png b/src/FeaturesPlugin/doc/images/translation_2pt_32x32.png new file mode 100644 index 000000000..5e6860737 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/translation_2pt_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/translation_dxyz_32x32.png b/src/FeaturesPlugin/doc/images/translation_dxyz_32x32.png new file mode 100644 index 000000000..a11f680d6 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/translation_dxyz_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/translation_vector_32x32.png b/src/FeaturesPlugin/doc/images/translation_vector_32x32.png new file mode 100644 index 000000000..2c1a4b2b7 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/translation_vector_32x32.png differ diff --git a/src/FeaturesPlugin/doc/rotationFeature.rst b/src/FeaturesPlugin/doc/rotationFeature.rst index ff0380d0c..38bef70b9 100644 --- a/src/FeaturesPlugin/doc/rotationFeature.rst +++ b/src/FeaturesPlugin/doc/rotationFeature.rst @@ -2,16 +2,88 @@ Rotation ======== +The feature **Rotation** makes rotation of a selected shape. + +To create Rotation in the active part: + +#. select in the Main Menu *Part - > Rotation* item or +#. click **Rotation** button in the toolbar + +.. image:: images/rotation.png + :align: center + +.. centered:: + **Rotation** button + +Two rotation algorithms are: + + .. image:: images/rotation_axis_32x32.png + :align: left + by axis and angle + + .. image:: images/rotation_3pt_32x32.png + :align: left + by center and 2 points + +Rotation by axis and angle +-------------------------- .. image:: images/Rotation1.png :align: center .. centered:: - Rotation by axis and angle + Rotation by axis and angle property panel + +Input fields: + +- **Main objects** panel contains shapes to be rotated. Shapes are selected in 3D OCC viewer or object browser; +- **Axis** defines the axis of rotation. Vector is edge, axis selected in 3D OCC viewer or object browser; +- **Angle** defines the angle by which the object is rotated. + +**TUI Command**: *model.addRotation(Part_doc, [shape], axis, angle)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + axis in format *model.selection(TYPE, shape)*+ real (angle value). + +Result +"""""" + +Result of operation is rotated initial shape. +.. image:: images/rotation_axis.png + :align: center + +.. centered:: + Rotation by axis and angle + +**See Also** a sample TUI Script of a :ref:`tui_rotation_axis` operation. + +Rotation by center and points +----------------------------- .. image:: images/Rotation2.png :align: center .. centered:: - Rotation by center and points + Rotation by center and 2 points property panel + +Input fields: + +- **Main objects** panel contains shapes to be rotated. Shapes are selected in 3D OCC viewer or object browser; +- **Center point**, **Start point**, **End point** define 3 points or vertices selected in 3D OCC viewer or object browser. Rotation axis will pass through the **Center point** and will be will be orthogonal to a plane defined by three points. Rotation Angle is the angle between two vectors directed from the **Center point** to **Start point** and **End point**. + +**TUI Command**: *model.addRotation(Part_doc, [shape], point1, point2, point3)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + 3 points in format *model.selection(TYPE, shape)*. + +Result +"""""" + +Result of operation is rotated initial shape. + +.. image:: images/rotation_3points.png + :align: center + +.. centered:: + Rotation by center and 2 points + +**See Also** a sample TUI Script of a :ref:`tui_rotation_3points` operation. \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/translationFeature.rst b/src/FeaturesPlugin/doc/translationFeature.rst index 99ce5db72..b3bbd5edc 100644 --- a/src/FeaturesPlugin/doc/translationFeature.rst +++ b/src/FeaturesPlugin/doc/translationFeature.rst @@ -2,23 +2,126 @@ Translation =========== +The feature **Translation** makes translation of a selected shape. + +To create Translation in the active part: + +#. select in the Main Menu *Part - > Translation* item or +#. click **Translation** button in the toolbar + +.. image:: images/translation_vector_32x32.png + :align: center + +.. centered:: + **Translation** button + +The Vector of translation can be defined in three different ways: + + .. image:: images/translation_vector_32x32.png + :align: left + by by axis and distance + + .. image:: images/translation_dxyz_32x32.png + :align: left + by vector + + .. image:: images/translation_2pt_32x32.png + :align: left + by two points + +Translation by axis and distance +-------------------------------- .. image:: images/Translation1.png :align: center .. centered:: - Translation by axis and distance + Translation by axis and distance property panel + +Input fields: + +- **Main objects** panel contains shapes to be translated. Shapes are selected in 3D OCC viewer or object browser; +- **Axis** defines vector along which the object will be translated. Vector is edge, axis selected in 3D OCC viewer or object browser; +- **Distance** defines the distance along the **Vector of translation**. + +**TUI Command**: *model.addTranslation(Part_doc, [shape], axis, dist)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + axis in format *model.selection(TYPE, shape)*+ real (distance value). + +Result +"""""" + +Result of operation is shifted initial shape. + +.. image:: images/translation_vector.png + :align: center + +.. centered:: + Translation by axis and distance + +**See Also** a sample TUI Script of a :ref:`tui_translation_vector` operation. +Translation by vector +--------------------- .. image:: images/Translation2.png :align: center .. centered:: - By vector + Translation by vector property panel +Input fields: + +- **Main objects** panel contains shapes to be translated. Shapes are selected in 3D OCC viewer or object browser; +- **DX**, **DY**, **DZ** define vector using coordinates along the axis. + +**TUI Command**: *model.addTranslation(Part_1_doc, [shape], DX, DY, DZ)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + 3 real (coordinate values). + +Result +"""""" + +Result of operation is shifted initial shape. + +.. image:: images/translation_vector.png + :align: center + +.. centered:: + Translation by vector + +**See Also** a sample TUI Script of a :ref:`tui_translation_DXDYDZ` operation. + + +Translation by two points +------------------------- .. image:: images/Translation3.png :align: center .. centered:: - By two points + Translation by two points property panel + +Input fields: + +- **Main objects** panel contains shapes to be translated. Shapes are selected in 3D OCC viewer or object browser; +- **Start point** defines start vector point as point or vertex selected in 3D OCC viewer or object browser; +- **End point** defines end vector point as point or vertex selected in 3D OCC viewer or object browser; + +**TUI Command**: *model.addTranslation(Part_doc, [shape], point1, point2)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + 2 points in format *model.selection(TYPE, shape)*. + +Result +"""""" + +Result of operation is shifted initial shape. + +.. image:: images/translation_vector.png + :align: center + +.. centered:: + Translation by two points + +**See Also** a sample TUI Script of a :ref:`tui_translation_2points` operation. +