From: gzy Date: Sun, 23 Sep 2018 07:43:26 +0000 (+0300) Subject: symmetry and scale X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9fead6b048ac4a14cfc90512ae766cb3a4f372eb;p=modules%2Fshaper.git symmetry and scale --- diff --git a/src/FeaturesPlugin/doc/TUI_scaleXYZFeature.rst b/src/FeaturesPlugin/doc/TUI_scaleXYZFeature.rst new file mode 100644 index 000000000..9b9f360b7 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_scaleXYZFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_Scale_XYZ: + +Scale by different factors along axes +===================================== + +.. literalinclude:: examples/scaleXYZ.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_scalefactorFeature.rst b/src/FeaturesPlugin/doc/TUI_scalefactorFeature.rst new file mode 100644 index 000000000..af4e71d96 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_scalefactorFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_Scale_common_factor: + +Scale by one common factor +========================== + +.. literalinclude:: examples/scalefactor.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_symmetryaxisFeature.rst b/src/FeaturesPlugin/doc/TUI_symmetryaxisFeature.rst new file mode 100644 index 000000000..43096341b --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_symmetryaxisFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_symmetry_axis: + +Symmetry through an Axis of symmetry +==================================== + +.. literalinclude:: examples/symmetryaxis.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_symmetryplaneFeature.rst b/src/FeaturesPlugin/doc/TUI_symmetryplaneFeature.rst new file mode 100644 index 000000000..cfafee3c2 --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_symmetryplaneFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_symmetry_plane: + +Symmetry through a Plane of symmetry +==================================== + +.. literalinclude:: examples/symmetryplane.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/TUI_symmetrypointFeature.rst b/src/FeaturesPlugin/doc/TUI_symmetrypointFeature.rst new file mode 100644 index 000000000..9a121640a --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_symmetrypointFeature.rst @@ -0,0 +1,11 @@ + + .. _tui_symmetry_point: + +Symmetry through a Point of symmetry +==================================== + +.. literalinclude:: examples/symmetrypoint.py + :linenos: + :language: python + +:download:`Download this script ` \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/examples/scaleXYZ.py b/src/FeaturesPlugin/doc/examples/scaleXYZ.py new file mode 100644 index 000000000..0a1a6fec7 --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/scaleXYZ.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() +Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10) +Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Sphere_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2 , 3, 4) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/scalefactor.py b/src/FeaturesPlugin/doc/examples/scalefactor.py new file mode 100644 index 000000000..9794ad4ce --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/scalefactor.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() +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/symmetryaxis.py b/src/FeaturesPlugin/doc/examples/symmetryaxis.py new file mode 100644 index 000000000..3ceb146fe --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/symmetryaxis.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() +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "Cylinder_1_1/Face_1"), False) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/symmetryplane.py b/src/FeaturesPlugin/doc/examples/symmetryplane.py new file mode 100644 index 000000000..549c89bfc --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/symmetryplane.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() +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("FACE", "Cylinder_1_1/Face_2"), True) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/examples/symmetrypoint.py b/src/FeaturesPlugin/doc/examples/symmetrypoint.py new file mode 100644 index 000000000..e71d7c68e --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/symmetrypoint.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() +Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10) +Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("VERTEX", "PartSet/Origin"), True) +model.do() +model.end() diff --git a/src/FeaturesPlugin/doc/images/Symmetry.png b/src/FeaturesPlugin/doc/images/Symmetry.png index a369a0f81..fdc73b21c 100644 Binary files a/src/FeaturesPlugin/doc/images/Symmetry.png and b/src/FeaturesPlugin/doc/images/Symmetry.png differ diff --git a/src/FeaturesPlugin/doc/images/scale.png b/src/FeaturesPlugin/doc/images/scale.png new file mode 100644 index 000000000..156659c3f Binary files /dev/null and b/src/FeaturesPlugin/doc/images/scale.png differ diff --git a/src/FeaturesPlugin/doc/images/scale_dimensions_32x32.png b/src/FeaturesPlugin/doc/images/scale_dimensions_32x32.png new file mode 100644 index 000000000..b5204f9e8 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/scale_dimensions_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/scale_factor_32x32.png b/src/FeaturesPlugin/doc/images/scale_factor_32x32.png new file mode 100644 index 000000000..b82b643c4 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/scale_factor_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/symmetry.png b/src/FeaturesPlugin/doc/images/symmetry.png new file mode 100644 index 000000000..fdc73b21c Binary files /dev/null and b/src/FeaturesPlugin/doc/images/symmetry.png differ diff --git a/src/FeaturesPlugin/doc/images/symmetry_axis_32x32.png b/src/FeaturesPlugin/doc/images/symmetry_axis_32x32.png new file mode 100644 index 000000000..3873378cf Binary files /dev/null and b/src/FeaturesPlugin/doc/images/symmetry_axis_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/symmetry_plane_32x32.png b/src/FeaturesPlugin/doc/images/symmetry_plane_32x32.png new file mode 100644 index 000000000..ddecb8256 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/symmetry_plane_32x32.png differ diff --git a/src/FeaturesPlugin/doc/images/symmetry_point_32x32.png b/src/FeaturesPlugin/doc/images/symmetry_point_32x32.png new file mode 100644 index 000000000..2cda2255a Binary files /dev/null and b/src/FeaturesPlugin/doc/images/symmetry_point_32x32.png differ diff --git a/src/FeaturesPlugin/doc/symmetryFeature.rst b/src/FeaturesPlugin/doc/symmetryFeature.rst index dc8150c74..bd2d5eb1b 100644 --- a/src/FeaturesPlugin/doc/symmetryFeature.rst +++ b/src/FeaturesPlugin/doc/symmetryFeature.rst @@ -2,9 +2,125 @@ Symmetry ======== +The feature **Symmetry** makes symmetrical copy of a selected shape. -.. image:: images/Symmetry.png +To create Symmetry in the active part: + +#. select in the Main Menu *Part - > Symmetry* item or +#. click **Symmetry** button in the toolbar + +.. image:: images/symmetry.png + :align: center + +.. centered:: + **Symmetry** button + +Symmetrical copy of an Object can be mirrored in three different ways: + + .. image:: images/symmetry_point_32x32.png + :align: left + through a Point of symmetry + + .. image:: images/symmetry_axis_32x32.png + :align: left + through an Axis of symmetry + + .. image:: images/symmetry_plane_32x32.png + :align: left + through a Plane of symmetry + +Symmetry through a Point of symmetry +------------------------------------ + +.. image:: images/symmetryPoint.png + :align: center + +.. centered:: + Symmetry through a Point of symmetry property panel + +Input fields: + +- **Main objects** panel contains shapes to be translated. Shapes are selected in 3D OCC viewer or object browser; +- **Point** defines point of symmetry selected in 3D OCC viewer or object browser; +- **Create a copy** checkbox turns on/off preservation of the initial object. + +**TUI Command**: *model.addSymmetry(Part_doc, [shape], point, copy)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + point in format *model.selection(TYPE, shape)*+ boolean (Create a copy key). + +Result +"""""" + +Result of operation is mirrored initial shape with **Create a copy** = *True*. + +.. image:: images/symmetryPointres.png + :align: center + +.. centered:: + Symmetry through a Point of symmetry + +**See Also** a sample TUI Script of a :ref:`tui_symmetry_point` operation. + +Symmetry through an Axis of symmetry +------------------------------------ + +.. image:: images/symmetryAxis.png :align: center .. centered:: - Symmetry definition + Symmetry through an Axis of symmetry property panel + +Input fields: + +- **Main objects** panel contains shapes to be translated. Shapes are selected in 3D OCC viewer or object browser; +- **Axis** defines axis of symmetry selected in 3D OCC viewer or object browser; +- **Create a copy** checkbox turns on/off preservation of the initial object. + +**TUI Command**: *model.addSymmetry(Part_doc, [shape], axis, copy)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + axis in format *model.selection(TYPE, shape)*+ boolean (Create a copy key). + +Result +"""""" + +Result of operation is mirrored initial shape with **Create a copy** = *False*. + +.. image:: images/symmetryAxisres.png + :align: center + +.. centered:: + Symmetry through an Axis of symmetry + +**See Also** a sample TUI Script of a :ref:`tui_symmetry_axis` operation. + +Symmetry through a Plane of symmetry +------------------------------------ + +.. image:: images/symmetryPlane.png + :align: center + +.. centered:: + Symmetry through a Plane of symmetry property panel + +Input fields: + +- **Main objects** panel contains shapes to be translated. Shapes are selected in 3D OCC viewer or object browser; +- **Plane** defines plane of symmetry selected in 3D OCC viewer or object browser; +- **Create a copy** checkbox turns on/off preservation of the initial object. + +**TUI Command**: *model.addSymmetry(Part_doc, [shape], plane, copy)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + plane in format *model.selection(TYPE, shape)*+ boolean (Create a copy key). + +Result +"""""" + +Result of operation is mirrored initial shape with **Create a copy** = *False*. + +.. image:: images/symmetryPlaneres.png + :align: center + +.. centered:: + Symmetry through a Plane of symmetry + +**See Also** a sample TUI Script of a :ref:`tui_symmetry_plane` operation. \ No newline at end of file diff --git a/src/FeaturesPlugin/doc/transformationFeature.rst b/src/FeaturesPlugin/doc/transformationFeature.rst index 5e8f204d7..8ca725554 100644 --- a/src/FeaturesPlugin/doc/transformationFeature.rst +++ b/src/FeaturesPlugin/doc/transformationFeature.rst @@ -2,16 +2,93 @@ Scale ===== +The feature **Scale** makes a scaled shape basing on the initial shape. + +To create Scale in the active part: + +#. select in the Main Menu *Features - > Scale* item or +#. click **Scale** button in the toolbar + +.. image:: images/scale.png + :align: center + +.. centered:: + **Scale** button + +Two Scale algorithms are: + + .. image:: images/scale_factor_32x32.png + :align: left + by one common factor + + .. image:: images/scale_dimensions_32x32.png + :align: left + by different factors along axes + +Scale by one common factor +-------------------------- + +Scale by one common factor scales the entire object without modification the geometry of the shape: dimensions change evenly in all three orthogonal directions. .. image:: images/Scale1.png :align: center .. centered:: - Scale: define by a one common factor + Scale by one common factor property panel + +Input fields: + +- **Main objects** panel contains shapes to be scaled. Shapes are selected in 3D OCC viewer or object browser; +- **Center point** defines the point relatively to which the object is scaled. Point is selected in 3D OCC viewer or object browser; +- **Scale factor** defines the multiplier of axial dimensions. If Scale Factor is negative, the object is mirrored through the Central Point. + +**TUI Command**: *model.addScale(Part_doc, [shape], center, factor)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + center point in format *model.selection(TYPE, shape)*+ real (scale factor value). + +Result +"""""" + +Result of operation is transformed initial shape. +.. image:: images/Scale_common_factor.png + :align: center + +.. centered:: + Scale by one common factor + +**See Also** a sample TUI Script of a :ref:`tui_Scale_common_factor` operation. + +Scale by different factors along axes +------------------------------------- + +Scale by different factors along axes is a general transformation, which can modify the geometry, for example, a sphere can be transformed into an ellipsoid. .. image:: images/Scale2.png :align: center .. centered:: - Scale: define by different factors + Scale: define by different factors property panel + +Input fields: + +- **Main objects** panel contains shapes to be scaled. Shapes are selected in 3D OCC viewer or object browser; +- **Center point** defines the point relatively to which the object is scaled. Point is selected in 3D OCC viewer or object browser; +- **Scale factor in X**, **Scale factor in Y**, **Scale factor in Z** define the the multipliers of axial dimensions. If Scale Factor is negative, the object is mirrored through the Central Point. + +**TUI Command**: *model.addScale(Part_doc, [shape], center, factors)* + +**Arguments**: part + list of shapes in format *model.selection(TYPE, shape)* + center point in format *model.selection(TYPE, shape)*+ 3 reals (scale factor values along X. Y, Z axes). + +Result +"""""" + +Result of operation is transformed initial shape. + +.. image:: images/Scale_common_factor.png + :align: center + +.. centered:: + Scale by different factors + +**See Also** a sample TUI Script of a :ref:`tui_Scale_XYZ` operation. \ No newline at end of file