diff --git a/doc/salome/gui/GEOM/images/mtrans1.png b/doc/salome/gui/GEOM/images/mtrans1.png
index f5752e4b1..2e9685574 100755
Binary files a/doc/salome/gui/GEOM/images/mtrans1.png and b/doc/salome/gui/GEOM/images/mtrans1.png differ
diff --git a/doc/salome/gui/GEOM/images/mtrans2.png b/doc/salome/gui/GEOM/images/mtrans2.png
index c61b1c3c1..8f051425b 100755
Binary files a/doc/salome/gui/GEOM/images/mtrans2.png and b/doc/salome/gui/GEOM/images/mtrans2.png differ
diff --git a/doc/salome/gui/GEOM/images/neo-mrot1.png b/doc/salome/gui/GEOM/images/neo-mrot1.png
index e94b5ab73..269fccc70 100755
Binary files a/doc/salome/gui/GEOM/images/neo-mrot1.png and b/doc/salome/gui/GEOM/images/neo-mrot1.png differ
diff --git a/doc/salome/gui/GEOM/images/neo-mrot2.png b/doc/salome/gui/GEOM/images/neo-mrot2.png
index f3f3c347e..b17098a75 100755
Binary files a/doc/salome/gui/GEOM/images/neo-mrot2.png and b/doc/salome/gui/GEOM/images/neo-mrot2.png differ
diff --git a/doc/salome/gui/GEOM/input/multi_rotation_operation.doc b/doc/salome/gui/GEOM/input/multi_rotation_operation.doc
index cdc6234a1..0238f6334 100644
--- a/doc/salome/gui/GEOM/input/multi_rotation_operation.doc
+++ b/doc/salome/gui/GEOM/input/multi_rotation_operation.doc
@@ -5,24 +5,28 @@
\n To produce a Multi Rotation in the Main Menu select
Operations - > Transformation - > Multi Rotation
-\n This operation creates several geometrical objects rotated in one
-or two dimensions basing on the initial geometrical object.
-\n The \b Result will be one or several \b GEOM_Objects (compound).
+\n This operation creates a compound of several shapes rotated in one
+or two dimensions basing on the initial shape.
+\n The \b Result will be one \b GEOM_Object (compound).
\n To produce a Simple Multi Rotation (in one dimension) you
-need to define a \b Shape to be rotated, an \b Axis of rotation and a
-Number of Times the shape must be rotated. Rotation Angle will
-be 2 * \a PI / \a NbTimes. Number of shapes in the resulting compound will be equal
-to \a NbTimes (if \a NbTimes = 1, the result will contain only the initial
-non-transformed shape).
-\n TUI Command: geompy.MultiRotate1D(Shape, Axis, NbTimes)
-\n Arguments: Name + 1 shape + 1 vector for direction + 1 value
-(repetition).
+need to define a \b Shape to be rotated, an \b Axis of rotation (DZ by
+default), Angle of rotation (optionally) and a Number of Times
+the shape must be rotated. If Angular step is not defined
+(checkbox is not checked), it will be 2 * \a PI / \a NbTimes. Number
+of shape's copies in the resulting compound will be equal to
+\a NbTimes (if \a NbTimes = 1, the result will contain only the
+initial non-transformed shape).
+
+\n TUI Commands:
+\n geompy.MultiRotate1DNbTimes(Shape, Axis, NbTimes)
+\n geompy.MultiRotate1DByStep(Shape, Axis, AngleStep, NbTimes)
\b NB! There is another way to execute a Multi-rotation
operation, which is currently accessible only via TUI commands:
-geompy.MakeMultiRotation1D(Shape, Dir, Point, NbTimes) which works in
-the same way, but the Axis is defined by direction and point.
+geompy.MakeMultiRotation1DNbTimes(Shape, Dir, Point, NbTimes),
+geompy.MakeMultiRotation1DByStep(Shape, Dir, Point, AngleStep, NbTimes),
+which works in the same way, but the Axis is defined by direction and point.
\image html neo-mrot1.png
@@ -31,23 +35,27 @@ the same way, but the Axis is defined by direction and point.
\image html multi_rotation1d2.png "The result of a simple multi-rotation"
\n Double Multi Rotation (in two dimensions) rotates the given
-\b Object around the given \b Axis on the given \b Angle a given
-Number of Times and multi-translates each rotation
-result. Translation direction passes through the center of gravity of
-the rotated shape and its projection on the rotation axis. Number of
-shapes in the resulting compound will be equal to \a NbTimes1 x \a NbTimes2 (if
-both \a NbTimes1 and \a NbTimes2 are equal to 1, the result will contain
+\b Object around the given \b Axis (DZ by default) on the given
+\b Angle (optional) a given Number of Times and
+multi-translates each rotation result.
+If Angular step is not defined (checkbox is not checked), it
+will be 2 * \a PI / \a NbTimes.
+Translation direction passes through the center of gravity of the
+initial shape and its projection on the rotation axis. Number of
+shape's copies in the resulting compound will be equal to \a NbTimes1 x \a NbTimes2
+(if both \a NbTimes1 and \a NbTimes2 are equal to 1, the result will contain
only the initial non-transformed shape).
\b Reverse checkbox allows to set the direction of rotation.
-\n TUI Command: geompy.MultiRotate2D(Shape, Axis, Angle, NbTimes1, Step, NbTimes2)
-\n Arguments: Name + 1 shape + 1 vector for direction + 1 angle
-+ 1 value (repetition) + 1 step value + 1 value (repetition).
+
+\n TUI Commands:
+\n geompy.MultiRotate2DNbTimes(Shape, Axis, NbTimes1, RadialStep, NbTimes2)
+\n geompy.MultiRotate2DByStep(Shape, Axis, AngleStep, NbTimes1, RadialStep, NbTimes2)
NB! There is another way to execute a Double Multi-rotation
operation, which is currently accessible only via TUI commands:
-geompy.MakeMultiRotation2D(Shape, Dir, Point, Angle, nbtimes1, Step,nbtimes2)
-which works in the same way,
-but the Axis is defined by direction and point.
+geompy.MakeMultiRotation2DNbTimes(Shape, Dir, Point, NbTimes1, RadialStep, NbTimes2),
+geompy.MakeMultiRotation2DByStep(Shape, Dir, Point, AngleStep, NbTimes1, RadialStep, NbTimes2),
+which works in the same way, but the Axis is defined by direction and point.
\image html neo-mrot2.png
diff --git a/doc/salome/gui/GEOM/input/multi_translation_operation.doc b/doc/salome/gui/GEOM/input/multi_translation_operation.doc
index 0d084f3c1..6274ad9b4 100644
--- a/doc/salome/gui/GEOM/input/multi_translation_operation.doc
+++ b/doc/salome/gui/GEOM/input/multi_translation_operation.doc
@@ -7,9 +7,8 @@ select Operations - > Transformation - > Multi Translation
\n This operation makes several translations of a shape in \b one or \b
two directions.
-\n The \b Result will be one or several \b GEOM_Objects
-(compound). The total number of shapes in the resulting compound (for
-a single initial selected shape) will be equal to:
+\n The \b Result will be one \b GEOM_Object (compound). The total
+number of shape copies in the resulting compound will be equal to:
- in case of \ref single_multi_translation "Single multi translation":
\a NbTimes (if \a NbTimes parameter is equal to 1, the result will
contain only the initial non-translated shape).
@@ -21,14 +20,11 @@ initial shape).
\anchor single_multi_translation
\n To produce a Simple Multi Translation (in one direction) you
need to indicate an \b Object to be translated, a \b Vector of
-translation, a \b Step of translation and a Number of Times the
-Object should be duplicated. If a curve has been selected instead of
-the Vector, only its first and last vertices will be used to get the vector direction
-and the dialog preview will display the vector along which the object will be translated.
-\n TUI Command: geompy.MakeMultiTranslation1D(Shape, Dir,
-Step, NbTimes)
-\n Arguments: Name + 1 shape + 1 vector (for direction) + 1
-step value + 1 value (repetition).
+translation (DX by default), a \b Step of translation and a Number
+of Times the Object should be duplicated. If a curve has been
+selected instead of the Vector, only its first and last vertices will
+be used to get the vector direction and the dialog preview will
+display the vector along which the object will be translated.
\image html mtrans1.png
@@ -36,12 +32,26 @@ step value + 1 value (repetition).
\image html multi_translation1dsn.png "The result of a simple multi-translation"
+\n TUI Command: geompy.MakeMultiTranslation1D(Shape, Dir,
+Step, NbTimes)
+\n Arguments: Name + 1 shape + 1 vector (for direction) + 1
+step value + 1 value (repetition).
+
\anchor double_multi_translation
\n To produce a Double Multi Translation (in two directions) you need to
indicate an \b Object to be translated, and, for both axes, a \b
-Vector of translation, a \b Step of translation and a Number of Times the shape must be duplicated.
-If a curve has been selected instead of the Vector, only its first and last vertices will be used to get the vector direction
-and the dialog preview will display the vector along which the object will be translated.
+Vector of translation (DX and DY by default), a \b Step of translation
+and a Number of Times the shape must be duplicated.
+If a curve has been selected instead of the Vector, only its first and
+last vertices will be used to get the vector direction and the dialog
+preview will display the vector along which the object will be
+translated.
+
+\image html mtrans2.png
+
+\image html multi_translation_initialsn.png "The initial object"
+
+\image html multi_translation2dsn.png "The result of a double multi-translation"
\n TUI Command: geompy.MakeMultiTranslation2D(Shape, Dir1,
Step1, NbTimes1, Dir2, Step2, NbTimes2), where \em Shape is a shape
@@ -53,12 +63,6 @@ along \em Dir2.
\n Arguments: Name + 1 shape + 2 vectors defining the direction
+ 2 step values + 2 values (repetitions).
-\image html mtrans2.png
-
-\image html multi_translation_initialsn.png "The initial object"
-
-\image html multi_translation2dsn.png "The result of a double multi-translation"
-
Our TUI Scripts provide you with useful examples of the use of
\ref tui_multi_translation "Transformation Operations".
diff --git a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc
index 09744cddf..9c582a897 100644
--- a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc
+++ b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc
@@ -340,6 +340,7 @@ gg.setDisplayMode(id_tr2d,1)
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
+import math
# create vertices and vectors
p0 = geompy.MakeVertex( 0., 0., 0.)
@@ -349,7 +350,7 @@ pz = geompy.MakeVertex( 0., 0., 20.)
pxyz = geompy.MakeVertex( 50., 50., 10.)
vz = geompy.MakeVector(p0, pz)
vxy = geompy.MakeVector(px, py)
-vrot1d = geompy.MakeVector(p0, pxyz)
+vrot = geompy.MakeVector(p0, pxyz)
# create an arc
arc = geompy.MakeArc(py, pz, px)
@@ -363,25 +364,41 @@ face = geompy.MakeFace(wire, 1)
# create a prism
prism = geompy.MakePrismVecH(face, vz, 20.0)
-# rotate the given object around the given axis by the given angle a given number of times
-rot1d = geompy.MultiRotate1D(prism, vrot1d, 4)
+# 1. Rotate the prism around the axis vrot 4 times
-# rotate the given object around the given axis by the given angle a given number of times
-# and multi-translate the result of each rotation
-rot2d = geompy.MultiRotate2D(prism, vrot1d, 60, 4, 50, 5)
+# rotation angle = 2 * PI / 4
+rot1da = geompy.MultiRotate1DNbTimes(prism, vrot, 4)
+
+# by the given angle of 30 degrees
+rot1db = geompy.MultiRotate1DByStep(prism, vrot, math.pi/6., 4)
+
+# 2. Rotate the prism around the axis vrot 4 times
+# and translate the result of each rotation 5 times on distance 50
+
+# rotation angle = 2 * PI / 4
+rot2da = geompy.MultiRotate2DNbTimes(prism, vrot, 4, 50, 5)
+
+# by the given angle of 60 degrees
+rot2db = geompy.MultiRotate2DByStep(prism, vrot, math.pi/3., 4, 50, 5)
# add objects in the study
id_prism = geompy.addToStudy(prism,"Prism")
-id_rot1d = geompy.addToStudy(rot1d,"Rotation 1D")
-id_rot2d = geompy.addToStudy(rot2d,"Rotation 2D")
+id_rot1da = geompy.addToStudy(rot1da,"Rotation 1D Nb.Times")
+id_rot1db = geompy.addToStudy(rot1db,"Rotation 1D By Step")
+id_rot2da = geompy.addToStudy(rot2da,"Rotation 2D Nb.Times")
+id_rot2db = geompy.addToStudy(rot2db,"Rotation 2D By Step")
# display the prism and the results of fillet operation
gg.createAndDisplayGO(id_prism)
gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_rot1d)
-gg.setDisplayMode(id_rot1d,1)
-gg.createAndDisplayGO(id_rot2d)
-gg.setDisplayMode(id_rot2d,1)
+gg.createAndDisplayGO(id_rot1da)
+gg.setDisplayMode(id_rot1da,1)
+gg.createAndDisplayGO(id_rot1db)
+gg.setDisplayMode(id_rot1db,1)
+gg.createAndDisplayGO(id_rot2da)
+gg.setDisplayMode(id_rot2da,1)
+gg.createAndDisplayGO(id_rot2db)
+gg.setDisplayMode(id_rot2db,1)
\endcode
\anchor tui_fillet2d
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index 4c0c92b2a..af98eeb8a 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -804,7 +804,7 @@ module GEOM
/*!
* \brief Translate the given object along the given vector a given number times
* \param theObject The object to be translated.
- * \param theVector Direction of the translation.
+ * \param theVector Direction of the translation. DX if None.
* \param theStep Distance to translate on.
* \param theNbTimes Quantity of translations to be done.
* \return New GEOM_Object, containing compound of all
@@ -818,10 +818,10 @@ module GEOM
/*!
* \brief Conseqently apply two specified translations to theObject specified number of times.
* \param theObject The object to be translated.
- * \param theVector1 Direction of the first translation.
+ * \param theVector1 Direction of the first translation. DX if None.
* \param theStep1 Step of the first translation.
* \param theNbTimes1 Quantity of translations to be done along theVector1.
- * \param theVector2 Direction of the second translation.
+ * \param theVector2 Direction of the second translation. DY if None.
* \param theStep2 Step of the second translation.
* \param theNbTimes2 Quantity of translations to be done along theVector2.
* \return New GEOM_Object, containing compound of all
@@ -888,20 +888,56 @@ module GEOM
in GEOM_Object theAxis,
in double theAngle);
-
/*!
* \brief Rotate the given object around the given axis a given number times.
*
- * Rotation angle will be 2*PI/theNbTimes.
+ * Rotation angle will be 2*PI/theNbObjects.
* \param theObject The object to be rotated.
- * \param theAxis The rotation axis.
- * \param theNbTimes Quantity of rotations to be done.
+ * \param theAxis The rotation axis. DZ if None.
+ * \param theNbObjects Quantity of rotations to be done.
* \return New GEOM_Object, containing compound of all the
* shapes, obtained after each rotation.
*/
GEOM_Object MultiRotate1D (in GEOM_Object theObject,
in GEOM_Object theAxis,
- in long theNbTimes);
+ in long theNbObjects);
+
+ /*!
+ * \brief Rotate the given object around the given axis
+ * a given number times on the given angle.
+ *
+ * \param theObject The object to be rotated.
+ * \param theAxis The rotation axis. DZ if None.
+ * \param theAngleStep Rotation angle in radians.
+ * \param theNbSteps Quantity of rotations to be done.
+ * \return New GEOM_Object, containing compound of all the
+ * shapes, obtained after each rotation.
+ */
+ GEOM_Object MultiRotate1DByStep (in GEOM_Object theObject,
+ in GEOM_Object theAxis,
+ in double theAngleStep,
+ in long theNbSteps);
+
+ /*!
+ * \brief Rotate the given object around the given axis
+ * a given number times and multi-translate each rotation result.
+ *
+ * Rotation angle will be 2*PI/theNbObjects.
+ * Translation direction passes through center of gravity
+ * of rotated shape and its projection on the rotation axis.
+ * \param theObject The object to be rotated.
+ * \param theAxis Rotation axis. DZ if None.
+ * \param theNbObjects Quantity of rotations to be done.
+ * \param theRadialStep Translation distance.
+ * \param theNbSteps Quantity of translations to be done.
+ * \return New GEOM_Object, containing compound of all the
+ * shapes, obtained after each transformation.
+ */
+ GEOM_Object MultiRotate2DNbTimes (in GEOM_Object theObject,
+ in GEOM_Object theAxis,
+ in long theNbObjects,
+ in double theRadialStep,
+ in long theNbSteps);
/*!
* \brief Rotate the given object around the
@@ -911,20 +947,43 @@ module GEOM
* Translation direction passes through center of gravity
* of rotated shape and its projection on the rotation axis.
* \param theObject The object to be rotated.
- * \param theAxis Rotation axis.
- * \param theAngle Rotation angle in graduces.
- * \param theNbTimes1 Quantity of rotations to be done.
- * \param theStep Translation distance.
- * \param theNbTimes2 Quantity of translations to be done.
+ * \param theAxis Rotation axis. DZ if None.
+ * \param theAngleStep Rotation angle in radians.
+ * \param theNbSteps1 Quantity of rotations to be done.
+ * \param theRadialStep Translation distance.
+ * \param theNbSteps2 Quantity of translations to be done.
+ * \return New GEOM_Object, containing compound of all the
+ * shapes, obtained after each transformation.
+ */
+ GEOM_Object MultiRotate2DByStep (in GEOM_Object theObject,
+ in GEOM_Object theAxis,
+ in double theAngleStep,
+ in long theNbSteps1,
+ in double theRadialStep,
+ in long theNbSteps2);
+
+ /*!
+ * \brief Rotate the given object around the
+ * given axis on the given angle a given number
+ * times and multi-translate each rotation result.
+ *
+ * Translation direction passes through center of gravity
+ * of rotated shape and its projection on the rotation axis.
+ * \param theObject The object to be rotated.
+ * \param theAxis Rotation axis. DZ if None.
+ * \param theAngleStep Rotation angle in degrees.
+ * \param theNbSteps1 Quantity of rotations to be done.
+ * \param theRadialStep Translation distance.
+ * \param theNbSteps2 Quantity of translations to be done.
* \return New GEOM_Object, containing compound of all the
* shapes, obtained after each transformation.
*/
GEOM_Object MultiRotate2D (in GEOM_Object theObject,
in GEOM_Object theAxis,
- in double theAngle,
- in long theNbTimes1,
- in double theStep,
- in long theNbTimes2);
+ in double theAngleStep,
+ in long theNbSteps1,
+ in double theRadialStep,
+ in long theNbSteps2);
/*!
* \brief Replace the given object by an object,
@@ -3629,6 +3688,16 @@ module GEOM
out double X1, out double Y1, out double Z1,
out double X2, out double Y2, out double Z2);
+ /*!
+ * \brief Get closest points of the given shapes.
+ * \param theShape1,theShape2 Shapes to find closest points of.
+ * \param theCoords Output. List of (X, Y, Z) coordinates for all couples of points.
+ * \return The number of found solutions (-1 in case of infinite number of solutions).
+ */
+ long ClosestPoints (in GEOM_Object theShape1,
+ in GEOM_Object theShape2,
+ out ListOfDouble theCoords);
+
/*!
* \brief Get angle between the given lines or linear edges.
* \param theShape1,theShape2 Shapes to find angle between. Lines or linear edges.
diff --git a/src/DlgRef/DlgRef.cxx b/src/DlgRef/DlgRef.cxx
index 164f483b4..01be686b6 100644
--- a/src/DlgRef/DlgRef.cxx
+++ b/src/DlgRef/DlgRef.cxx
@@ -15,7 +15,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// File : DlgRef.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
@@ -526,20 +525,6 @@ DlgRef_2Sel3Spin::~DlgRef_2Sel3Spin()
{
}
-//////////////////////////////////////////
-// DlgRef_2Sel4Spin1Check
-//////////////////////////////////////////
-
-DlgRef_2Sel4Spin1Check::DlgRef_2Sel4Spin1Check( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
-{
- setupUi( this );
-}
-
-DlgRef_2Sel4Spin1Check::~DlgRef_2Sel4Spin1Check()
-{
-}
-
//////////////////////////////////////////
// DlgRef_2Sel
//////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef.h b/src/DlgRef/DlgRef.h
index bda6da5b5..bb707a511 100644
--- a/src/DlgRef/DlgRef.h
+++ b/src/DlgRef/DlgRef.h
@@ -15,7 +15,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// File : DlgRef.h
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
@@ -611,22 +610,6 @@ public:
~DlgRef_2Sel3Spin();
};
-//////////////////////////////////////////
-// DlgRef_2Sel4Spin1Check
-//////////////////////////////////////////
-
-#include "ui_DlgRef_2Sel4Spin1Check_QTD.h"
-
-class DLGREF_EXPORT DlgRef_2Sel4Spin1Check : public QWidget,
- public Ui::DlgRef_2Sel4Spin1Check_QTD
-{
- Q_OBJECT
-
-public:
- DlgRef_2Sel4Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 );
- ~DlgRef_2Sel4Spin1Check();
-};
-
//////////////////////////////////////////
// DlgRef_2Sel
//////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui b/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui
deleted file mode 100644
index 5d0afce71..000000000
--- a/src/DlgRef/DlgRef_2Sel4Spin1Check_QTD.ui
+++ /dev/null
@@ -1,237 +0,0 @@
-
- DlgRef_2Sel4Spin1Check_QTD
-
-
-
- 0
- 0
- 156
- 197
-
-
-
-
-
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
-
-
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 9
-
-
- 6
-
-
- 6
-
-
-
-
-
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TL6
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TL5
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TL4
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TL3
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TL2
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
- -
-
-
- -
-
-
-
- 0
- 0
-
-
-
- TL1
-
-
- false
-
-
-
- -
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
- qPixmapFromMimeSource
-
-
- SalomeApp_DoubleSpinBox
- QDoubleSpinBox
- SalomeApp_DoubleSpinBox.h
-
-
- SalomeApp_IntSpinBox
- QSpinBox
-
-
-
-
- PushButton1
- LineEdit1
- PushButton2
- LineEdit2
- SpinBox_DX1
- SpinBox_DY1
- CheckButton1
- SpinBox_DX2
- SpinBox_DY2
-
-
-
-
diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am
index deaa27026..3e5d05b63 100644
--- a/src/DlgRef/Makefile.am
+++ b/src/DlgRef/Makefile.am
@@ -15,9 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# GEOM DLGREF :
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : DlgRef
@@ -72,7 +70,6 @@ UIC_FILES = \
ui_DlgRef_2Sel2Spin2Push_QTD.h \
ui_DlgRef_2Sel3Spin2Rb_QTD.h \
ui_DlgRef_2Sel3Spin_QTD.h \
- ui_DlgRef_2Sel4Spin1Check_QTD.h \
ui_DlgRef_2Sel_QTD.h \
ui_DlgRef_2SelExt_QTD.h \
ui_DlgRef_2Spin_QTD.h \
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index 1eeee7c48..c0ec2c792 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -125,6 +125,10 @@ Please, select face, shell or solid and try again
Angle
+
+
+ Angular step :
+
Arc of ellipse
@@ -1950,6 +1954,10 @@ Please, select face, shell or solid and try again
Step :
+
+
+ Radial step :
+
Step value for GUI constructions
diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
index 9b754517f..c296d9c58 100644
--- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
@@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include
@@ -500,7 +499,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
{
SetErrorCode(KO);
- if (theObject.IsNull() || theVector.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
@@ -515,9 +514,10 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate1D
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
- GEOMImpl_ITranslate aTI(aFunction);
- aTI.SetVector(theVector->GetLastFunction());
+ GEOMImpl_ITranslate aTI (aFunction);
aTI.SetOriginal(aLastFunction);
+ if (!theVector.IsNull())
+ aTI.SetVector(theVector->GetLastFunction());
aTI.SetStep1(theStep);
aTI.SetNbIter1(theNbTimes);
@@ -560,7 +560,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje
{
SetErrorCode(KO);
- if (theObject.IsNull() || theVector.IsNull() || theVector2.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
@@ -576,11 +576,13 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Translate2D (Handle(GEOM_Obje
if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
GEOMImpl_ITranslate aTI (aFunction);
- aTI.SetVector(theVector->GetLastFunction());
- aTI.SetVector2(theVector2->GetLastFunction());
aTI.SetOriginal(aLastFunction);
+ if (!theVector.IsNull())
+ aTI.SetVector(theVector->GetLastFunction());
aTI.SetStep1(theStep1);
aTI.SetNbIter1(theNbTimes1);
+ if (!theVector2.IsNull())
+ aTI.SetVector2(theVector2->GetLastFunction());
aTI.SetStep2(theStep2);
aTI.SetNbIter2(theNbTimes2);
@@ -1675,10 +1677,12 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate (Handle(GEOM_Object) t
//=============================================================================
/*!
- * Rotate
+ * RotateCopy
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle)
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ double theAngle)
{
SetErrorCode(KO);
@@ -1728,7 +1732,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec
//=============================================================================
/*!
- * Rotate1D
+ * Rotate1D (for MultiRotate1DNbTimes)
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
@@ -1737,7 +1741,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object)
{
SetErrorCode(KO);
- if (theObject.IsNull() || theAxis.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
@@ -1754,7 +1758,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object)
GEOMImpl_IRotate aRI(aFunction);
aRI.SetOriginal(aLastFunction);
- aRI.SetAxis(theAxis->GetLastFunction());
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
aRI.SetNbIter1(theNbTimes);
//Compute the translation
@@ -1774,7 +1779,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object)
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1D("
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
<< theObject << ", " << theAxis << ", " << theNbTimes << ")";
SetErrorCode(OK);
@@ -1783,19 +1788,17 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object)
//=============================================================================
/*!
- * Rotate2D
+ * Rotate1D (for MultiRotate1DByStep)
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theAxis,
- double theAngle,
- Standard_Integer theNbTimes1,
- double theStep,
- Standard_Integer theNbTimes2)
+ double theAngleStep,
+ Standard_Integer theNbSteps)
{
SetErrorCode(KO);
- if (theObject.IsNull() || theAxis.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
@@ -1804,19 +1807,21 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object)
Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
//Add a rotate function
- aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
+ aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
if (aFunction.IsNull()) return NULL;
- //Check if the function is set correctly
+ //Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
- GEOMImpl_IRotate aRI(aFunction);
- aRI.SetAxis(theAxis->GetLastFunction());
+ //Convert angle into degrees
+ double anAngleStep = theAngleStep * 180. / M_PI;
+
+ GEOMImpl_IRotate aRI (aFunction);
aRI.SetOriginal(aLastFunction);
- aRI.SetNbIter1(theNbTimes1);
- aRI.SetNbIter2(theNbTimes2);
- aRI.SetAngle(theAngle);
- aRI.SetStep(theStep);
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
+ aRI.SetAngle(anAngleStep);
+ aRI.SetNbIter1(theNbSteps);
//Compute the translation
try {
@@ -1835,9 +1840,140 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object)
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2D("
- << theObject << ", " << theAxis << ", " << theAngle << ", "
- << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
+ GEOM::TPythonDump(aFunction)
+ << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
+ << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
+
+ SetErrorCode(OK);
+ return aCopy;
+}
+
+//=============================================================================
+/*!
+ * Rotate2D (for MultiRotate2DNbTimes)
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ Standard_Integer theNbObjects,
+ double theRadialStep,
+ Standard_Integer theNbSteps)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) return NULL;
+
+ Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
+
+ //Add a new Copy object
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+
+ //Add a rotate function
+ aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
+
+ double anAngle = 360. / (double)theNbObjects;
+
+ GEOMImpl_IRotate aRI (aFunction);
+ aRI.SetOriginal(aLastFunction);
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
+ aRI.SetAngle(anAngle);
+ aRI.SetNbIter1(theNbObjects);
+ aRI.SetStep(theRadialStep);
+ aRI.SetNbIter2(theNbSteps);
+
+ //Compute the translation
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Rotate driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
+ << theObject << ", " << theAxis << ", " << theNbObjects
+ << ", " << theRadialStep << ", " << theNbSteps << ")";
+
+ SetErrorCode(OK);
+ return aCopy;
+}
+
+//=============================================================================
+/*!
+ * Rotate2D (for MultiRotate2DByStep)
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ double theAngleStep,
+ Standard_Integer theNbTimes1,
+ double theStep,
+ Standard_Integer theNbTimes2)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) return NULL;
+
+ Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
+
+ //Add a new Copy object
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+
+ //Add a rotate function
+ aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
+
+ //Convert angle into degrees
+ double anAngleStep = theAngleStep * 180. / M_PI;
+
+ GEOMImpl_IRotate aRI (aFunction);
+ aRI.SetOriginal(aLastFunction);
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
+ aRI.SetAngle(anAngleStep);
+ aRI.SetNbIter1(theNbTimes1);
+ aRI.SetStep(theStep);
+ aRI.SetNbIter2(theNbTimes2);
+
+ //Compute the translation
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Rotate driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction)
+ << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
+ << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
+ << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
SetErrorCode(OK);
return aCopy;
@@ -1858,7 +1994,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePoints (Handle(GEO
if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
- if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
// Get last functions of the arguments
Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx
index 270854229..a003f0fb9 100644
--- a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx
@@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOMImpl_ITransformOperations_HXX_
#define _GEOMImpl_ITransformOperations_HXX_
@@ -154,6 +153,17 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations
Handle(GEOM_Object) theAxis,
Standard_Integer theNbTimes);
+ Standard_EXPORT Handle(GEOM_Object) Rotate1D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ double theAngleStep,
+ Standard_Integer theNbSteps);
+
+ Standard_EXPORT Handle(GEOM_Object) Rotate2D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ Standard_Integer theNbObjects,
+ double theRadialStep,
+ Standard_Integer theNbSteps);
+
Standard_EXPORT Handle(GEOM_Object) Rotate2D (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theAxis,
double theAngle,
diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx
index 9f1e3035b..036538018 100644
--- a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx
@@ -18,35 +18,41 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include
#include
#include
#include
+
#include
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
#include
#include
#include
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
//=======================================================================
//function : GetID
@@ -92,13 +98,12 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const
Handle(GEOM_Function) anAxis = RI.GetAxis();
if (anAxis.IsNull()) return 0;
TopoDS_Shape A = anAxis->GetValue();
- if (A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0;
+ gp_Vec aV = GEOMUtils::GetVector(A);
TopoDS_Edge anEdge = TopoDS::Edge(A);
-
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
- gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
- gp_Dir aDir(gp_Vec(aP1, aP2));
- gp_Ax1 anAx1(aP1, aDir);
+ gp_Dir aDir (aV);
+ gp_Ax1 anAx1 (aP1, aDir);
+
Standard_Real anAngle = RI.GetAngle();
if (fabs(anAngle) < Precision::Angular()) anAngle += 2.*M_PI; // NPAL19665,19769
aTrsf.SetRotation(anAx1, anAngle);
@@ -148,22 +153,24 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const
TopLoc_Location aLocRes (aTrsfOrig);
aShape = anOriginal.Located(aLocRes);
}
- else if (aType == ROTATE_1D) {
+ else if (aType == ROTATE_1D || aType == ROTATE_1D_STEP) {
//Get direction
+ gp_Pnt aP1 = gp::Origin();
+ gp_Dir D = gp::DZ();
Handle(GEOM_Function) anAxis = RI.GetAxis();
- if(anAxis.IsNull()) return 0;
- TopoDS_Shape A = anAxis->GetValue();
- if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(A);
-
- gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
- gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
- gp_Dir D(gp_Vec(aP1, aP2));
-
- gp_Ax1 AX1(aP1, D);
+ if (!anAxis.IsNull()) {
+ TopoDS_Shape A = anAxis->GetValue();
+ gp_Vec aV = GEOMUtils::GetVector(A);
+ TopoDS_Edge anEdge = TopoDS::Edge(A);
+ aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
+ D = gp_Dir(aV);
+ }
+ gp_Ax1 AX1 (aP1, D);
Standard_Integer nbtimes = RI.GetNbIter1();
- Standard_Real angle = 360.0/nbtimes;
+ Standard_Real angle = 360. / nbtimes;
+ if (aType == ROTATE_1D_STEP)
+ angle = RI.GetAngle();
TopoDS_Compound aCompound;
BRep_Builder B;
@@ -177,7 +184,7 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const
B.Add(aCompound, anOriginal);
}
else {
- aTrsf.SetRotation(AX1, i*angle*M_PI/180.);
+ aTrsf.SetRotation(AX1, i * angle * M_PI / 180.);
//TopLoc_Location aLocRes (aTrsf * aTrsfOrig); // gp_Trsf::Multiply() has a bug
gp_Trsf aTrsfNew (aTrsfOrig);
aTrsfNew.PreMultiply(aTrsf);
@@ -194,16 +201,17 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const
}
else if (aType == ROTATE_2D) {
//Get direction
+ gp_Pnt aP1 = gp::Origin();
+ gp_Dir D = gp::DZ();
Handle(GEOM_Function) anAxis = RI.GetAxis();
- if(anAxis.IsNull()) return 0;
- TopoDS_Shape A = anAxis->GetValue();
- if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(A);
- gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
- gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
- gp_Dir D(gp_Vec(aP1, aP2));
-
- gp_Ax1 AX1(aP1, D);
+ if (!anAxis.IsNull()) {
+ TopoDS_Shape A = anAxis->GetValue();
+ gp_Vec aV = GEOMUtils::GetVector(A);
+ TopoDS_Edge anEdge = TopoDS::Edge(A);
+ aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
+ D = gp_Dir(aV);
+ }
+ gp_Ax1 AX1 (aP1, D);
gp_Trsf aTrsf1;
gp_Trsf aTrsf2;
@@ -274,7 +282,7 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const
B.Add(aCompound, anOriginal.Located(aLocRes));
}
else {
- aTrsf2.SetRotation(AX1, j*ang*M_PI/180.);
+ aTrsf2.SetRotation(AX1, j * ang * M_PI / 180.);
//TopLoc_Location aLocRes (aTrsf2 * aTrsf1 * aTrsfOrig); // gp_Trsf::Multiply() has a bug
gp_Trsf aTrsfNew (aTrsfOrig);
aTrsfNew.PreMultiply(aTrsf1);
diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx
index 575cbaea9..1f6de2170 100644
--- a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx
@@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include
@@ -173,13 +172,14 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
B.MakeCompound( aCompound );
Handle(GEOM_Function) aVector = TI.GetVector();
- if(aVector.IsNull()) return 0;
- TopoDS_Shape aV = aVector->GetValue();
- if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(aV);
-
- gp_Vec Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
- Vec.Normalize();
+ gp_Vec Vec = gp::DX();
+ if (!aVector.IsNull()) {
+ TopoDS_Shape aV = aVector->GetValue();
+ if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
+ TopoDS_Edge anEdge = TopoDS::Edge(aV);
+ Vec = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec.Normalize();
+ }
TopLoc_Location aLocOrig = anOriginal.Location();
gp_Trsf aTrsfOrig = aLocOrig.Transformation();
@@ -202,32 +202,36 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
}
else if (aType == TRANSLATE_2D) {
Standard_Integer nbtimes1 = TI.GetNbIter1(), nbtimes2 = TI.GetNbIter2();
- Standard_Real DX, DY, DZ, step1 = TI.GetStep1(), step2 = TI.GetStep2();
- gp_Vec aVec;
+ Standard_Real DX, DY, DZ, step1 = TI.GetStep1(), step2 = TI.GetStep2();
Handle(GEOM_Function) aVector = TI.GetVector();
- if(aVector.IsNull()) return 0;
- TopoDS_Shape aV = aVector->GetValue();
- if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(aV);
-
- gp_Vec Vec1(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
- Vec1.Normalize();
-
Handle(GEOM_Function) aVector2 = TI.GetVector2();
- if(aVector2.IsNull()) return 0;
- aV = aVector2->GetValue();
- if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- anEdge = TopoDS::Edge(aV);
- gp_Vec Vec2(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
- Vec2.Normalize();
+ gp_Vec Vec1 = gp::DX();
+ gp_Vec Vec2 = gp::DY();
+
+ if (!aVector.IsNull()) {
+ TopoDS_Shape aV = aVector->GetValue();
+ if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
+ TopoDS_Edge anEdge = TopoDS::Edge(aV);
+ Vec1 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec1.Normalize();
+ }
+
+ if (!aVector2.IsNull()) {
+ TopoDS_Shape aV = aVector2->GetValue();
+ if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
+ TopoDS_Edge anEdge = TopoDS::Edge(aV);
+ Vec2 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec2.Normalize();
+ }
TopoDS_Compound aCompound;
BRep_Builder B;
- B.MakeCompound( aCompound );
+ B.MakeCompound(aCompound);
TopLoc_Location aLocOrig = anOriginal.Location();
gp_Trsf aTrsfOrig = aLocOrig.Transformation();
+ gp_Vec aVec;
for (int i = 0; i < nbtimes1; i++) {
for (int j = 0; j < nbtimes2; j++) {
diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx
index 687eb7f15..0419dd169 100755
--- a/src/GEOMImpl/GEOMImpl_Types.hxx
+++ b/src/GEOMImpl/GEOMImpl_Types.hxx
@@ -153,6 +153,7 @@
#define ROTATE_2D 4
#define ROTATE_THREE_POINTS 5
#define ROTATE_THREE_POINTS_COPY 6
+#define ROTATE_1D_STEP 7
#define MIRROR_PLANE 1
#define MIRROR_PLANE_COPY 2
diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc
index 66bcb5288..257822004 100644
--- a/src/GEOM_I/GEOM_IMeasureOperations_i.cc
+++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc
@@ -518,6 +518,52 @@ CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance
return GetOperations()->GetMinDistance(aShape1, aShape2, X1, Y1, Z1, X2, Y2, Z2);
}
+//=============================================================================
+/*!
+ * ClosestPoints
+ */
+//=============================================================================
+CORBA::Long GEOM_IMeasureOperations_i::ClosestPoints
+ (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr theShape2,
+ GEOM::ListOfDouble_out theCoords)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // allocate the CORBA array
+ int nbSols = -1;
+ GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
+ Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
+
+ if (!aShape1.IsNull() && !aShape2.IsNull()) {
+ Handle(TColStd_HSequenceOfReal) aDoubles = new TColStd_HSequenceOfReal;
+ // Get shape parameters
+ //nbSols = GetOperations()->ClosestPoints(aShape1, aShape2, aDoubles);
+ //int nbDbls = aDoubles->Length();
+ //aDoublesArray->length(nbDbls);
+ //for (int id = 0; id < nbDbls; id++) {
+ // aDoublesArray[id] = aDoubles->Value(id + 1);
+ //}
+ // tmp
+ double X1, Y1, Z1, X2, Y2, Z2;
+ GetOperations()->GetMinDistance(aShape1, aShape2, X1, Y1, Z1, X2, Y2, Z2);
+ aDoublesArray->length(6);
+ aDoublesArray[0] = X1;
+ aDoublesArray[1] = Y1;
+ aDoublesArray[2] = Z1;
+ aDoublesArray[3] = X2;
+ aDoublesArray[4] = Y2;
+ aDoublesArray[5] = Z2;
+ nbSols = 1;
+ }
+
+ theCoords = aDoublesArray._retn();
+ return nbSols;
+}
+
//=============================================================================
/*!
* PointCoordinates
diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.hh b/src/GEOM_I/GEOM_IMeasureOperations_i.hh
index 0f68c3510..e8269bd22 100644
--- a/src/GEOM_I/GEOM_IMeasureOperations_i.hh
+++ b/src/GEOM_I/GEOM_IMeasureOperations_i.hh
@@ -103,6 +103,10 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i :
CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1,
CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2);
+ CORBA::Long ClosestPoints (GEOM::GEOM_Object_ptr theShape1,
+ GEOM::GEOM_Object_ptr theShape2,
+ GEOM::ListOfDouble_out theCoords);
+
void PointCoordinates (GEOM::GEOM_Object_ptr theShape,
CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z);
diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.cc b/src/GEOM_I/GEOM_ITransformOperations_i.cc
index 59bc4a293..05b132959 100644
--- a/src/GEOM_I/GEOM_ITransformOperations_i.cc
+++ b/src/GEOM_I/GEOM_ITransformOperations_i.cc
@@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include
@@ -958,7 +957,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D
//Get the vector of translation
Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
- if (aVector.IsNull()) return aGEOMObject._retn();
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DX by default
//Perform the translation
Handle(GEOM_Object) anObject =
@@ -992,11 +991,11 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_
//Get the vector1 of translation
Handle(GEOM_Object) aVector1 = GetObjectImpl(theVector1);
- if (aVector1.IsNull()) return aGEOMObject._retn();
+ //if (aVector1.IsNull()) return aGEOMObject._retn(); // DX by default
//Get the vector2 of translation
Handle(GEOM_Object) aVector2 = GetObjectImpl(theVector2);
- if (aVector2.IsNull()) return aGEOMObject._retn();
+ //if (aVector2.IsNull()) return aGEOMObject._retn(); // DY by default
//Perform the translation
Handle(GEOM_Object) anObject = GetOperations()->Translate2D
@@ -1026,7 +1025,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Obj
//Get the a directon of rotation
Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
- if (aVector.IsNull()) return aGEOMObject._retn();
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
//Perform the rotation
Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
@@ -1035,6 +1034,101 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Obj
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MultiRotate1DByStep
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngleStep,
+ CORBA::Long theNbSteps)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Get the object itself
+ Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+ if (aBasicObject.IsNull()) return aGEOMObject._retn();
+
+ //Get the a directon of rotation
+ Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ //Perform the rotation
+ Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theAngleStep, theNbSteps);
+ if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MultiRotate2DNbTimes
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DNbTimes (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Long theNbObjects,
+ CORBA::Double theRadialStep,
+ CORBA::Long theNbSteps)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Get the object itself
+ Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+ if (aBasicObject.IsNull()) return aGEOMObject._retn();
+
+ //Get the a directon of rotation
+ Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ //Perform the rotation
+ Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
+ (aBasicObject, aVector, theNbObjects, theRadialStep, theNbSteps);
+ if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MultiRotate2DByStep
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngle,
+ CORBA::Long theNbTimes1,
+ CORBA::Double theStep,
+ CORBA::Long theNbTimes2)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Get the object itself
+ Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+ if (aBasicObject.IsNull()) return aGEOMObject._retn();
+
+ //Get the a directon of rotation
+ Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ //Perform the rotation
+ Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
+ (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
+ if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MultiRotate2D
@@ -1058,11 +1152,13 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Obj
//Get the a directon of rotation
Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
- if (aVector.IsNull()) return aGEOMObject._retn();
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ double anAngle = M_PI * theAngle / 180.;
//Perform the rotation
Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
- (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
+ (aBasicObject, aVector, anAngle, theNbTimes1, theStep, theNbTimes2);
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
return GetObject(anObject);
diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.hh b/src/GEOM_I/GEOM_ITransformOperations_i.hh
index f01f08c22..7f7964ce4 100644
--- a/src/GEOM_I/GEOM_ITransformOperations_i.hh
+++ b/src/GEOM_I/GEOM_ITransformOperations_i.hh
@@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOM_ITransformOperations_i_HeaderFile
#define _GEOM_ITransformOperations_i_HeaderFile
@@ -39,17 +38,17 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
{
public:
GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA,
- GEOM::GEOM_Gen_ptr theEngine,
- ::GEOMImpl_ITransformOperations* theImpl);
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_ITransformOperations* theImpl);
~GEOM_ITransformOperations_i();
GEOM::GEOM_Object_ptr TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject,
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
@@ -59,15 +58,15 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
GEOM::GEOM_Object_ptr TranslateVector (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector);
+ GEOM::GEOM_Object_ptr theVector);
GEOM::GEOM_Object_ptr TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector);
+ GEOM::GEOM_Object_ptr theVector);
GEOM::GEOM_Object_ptr TranslateVectorDistance (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector,
- CORBA::Double theDistance,
- CORBA::Boolean theCopy);
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theDistance,
+ CORBA::Boolean theCopy);
GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theVector,
@@ -81,93 +80,111 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
GEOM::GEOM_Object_ptr Rotate (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theAxis,
- CORBA::Double theAngle);
+ CORBA::Double theAngle);
GEOM::GEOM_Object_ptr MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector,
- CORBA::Long theNbTimes);
-
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Long theNbTimes);
+
+ GEOM::GEOM_Object_ptr MultiRotate1DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngleStep,
+ CORBA::Long theNbSteps);
+
+ GEOM::GEOM_Object_ptr MultiRotate2DNbTimes (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Long theNbObjects,
+ CORBA::Double theRadialStep,
+ CORBA::Long theNbSteps);
+
+ GEOM::GEOM_Object_ptr MultiRotate2DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngle,
+ CORBA::Long theNbTimes1,
+ CORBA::Double theStep,
+ CORBA::Long theNbTimes2);
+
GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector,
- CORBA::Double theAngle,
- CORBA::Long theNbTimes1,
- CORBA::Double theStep,
- CORBA::Long theNbTimes2);
-
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngle,
+ CORBA::Long theNbTimes1,
+ CORBA::Double theStep,
+ CORBA::Long theNbTimes2);
+
GEOM::GEOM_Object_ptr RotateCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theAxis,
- CORBA::Double theAngle);
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngle);
GEOM::GEOM_Object_ptr MirrorPlane (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePlane);
+ GEOM::GEOM_Object_ptr thePlane);
GEOM::GEOM_Object_ptr MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePlane);
+ GEOM::GEOM_Object_ptr thePlane);
GEOM::GEOM_Object_ptr MirrorAxis (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theAxis);
+ GEOM::GEOM_Object_ptr theAxis);
GEOM::GEOM_Object_ptr MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theAxis);
+ GEOM::GEOM_Object_ptr theAxis);
GEOM::GEOM_Object_ptr MirrorPoint (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint);
+ GEOM::GEOM_Object_ptr thePoint);
GEOM::GEOM_Object_ptr MirrorPointCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint);
+ GEOM::GEOM_Object_ptr thePoint);
GEOM::GEOM_Object_ptr OffsetShape (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theOffset);
+ CORBA::Double theOffset);
GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theOffset);
+ CORBA::Double theOffset);
GEOM::GEOM_Object_ptr ProjectShapeCopy (GEOM::GEOM_Object_ptr theSource,
GEOM::GEOM_Object_ptr theTarget);
GEOM::GEOM_Object_ptr ScaleShape (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactor);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactor);
GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactor);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactor);
GEOM::GEOM_Object_ptr ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactorX,
- CORBA::Double theFactorY,
- CORBA::Double theFactorZ);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactorX,
+ CORBA::Double theFactorY,
+ CORBA::Double theFactorZ);
GEOM::GEOM_Object_ptr ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactorX,
- CORBA::Double theFactorY,
- CORBA::Double theFactorZ);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactorX,
+ CORBA::Double theFactorY,
+ CORBA::Double theFactorZ);
GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theStartLCS,
- GEOM::GEOM_Object_ptr theEndLCS);
+ GEOM::GEOM_Object_ptr theStartLCS,
+ GEOM::GEOM_Object_ptr theEndLCS);
GEOM::GEOM_Object_ptr PositionShapeCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theStartLCS,
- GEOM::GEOM_Object_ptr theEndLCS);
+ GEOM::GEOM_Object_ptr theStartLCS,
+ GEOM::GEOM_Object_ptr theEndLCS);
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePath,
- CORBA::Double theDistance,
- CORBA::Boolean theCopy,
- CORBA::Boolean theReverse);
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Double theDistance,
+ CORBA::Boolean theCopy,
+ CORBA::Boolean theReverse);
GEOM::GEOM_Object_ptr RotateThreePoints (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theCentPoint,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr theCentPoint,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr RotateThreePointsCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theCentPoint,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr theCentPoint,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TransformLikeOtherCopy (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theSample);
diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py
index 4eb309e4c..bffea27ea 100644
--- a/src/GEOM_SWIG/GEOM_TestAll.py
+++ b/src/GEOM_SWIG/GEOM_TestAll.py
@@ -290,9 +290,8 @@ def TestAll (geompy, math):
#Create Patterns
MultiTrans1D = geompy.MakeMultiTranslation1D(Fillet, vz, step1, nbtimes1)
MultiTrans2D = geompy.MakeMultiTranslation2D(Fillet, vz, step1, nbtimes1, vy, step2, nbtimes2)
- #!!!!Angle In Degree!!!!
- MultiRot1D = geompy.MultiRotate1D(Chamfer, vx, nbtimes1)
- MultiRot2D = geompy.MultiRotate2D(Chamfer, vx, angle, nbtimes1, step1, nbtimes2)
+ MultiRot1D = geompy.MultiRotate1DNbTimes(Chamfer, vx, nbtimes1)
+ MultiRot2D = geompy.MultiRotate2DByStep(Chamfer, vx, angle1, nbtimes1, step1, nbtimes2)
#Create Informations objects
CDG = geompy.MakeCDG(Prism) #(GEOM_Object)->GEOM_Object
diff --git a/src/GEOM_SWIG/GEOM_TestOthers.py b/src/GEOM_SWIG/GEOM_TestOthers.py
index 42429b3ca..afd2a0af5 100644
--- a/src/GEOM_SWIG/GEOM_TestOthers.py
+++ b/src/GEOM_SWIG/GEOM_TestOthers.py
@@ -186,8 +186,8 @@ def TestOtherOperations (geompy, math):
pz = geompy.MakeVertex(0, 0, 100)
vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
- MultiRot1D = geompy.MakeMultiRotation1D(f12, vy, pz, 6)
- MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
+ MultiRot1D = geompy.MakeMultiRotation1DNbTimes(f12, vy, pz, 6)
+ MultiRot2D = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4, 6, 30, 3)
id_MultiRot1D = geompy.addToStudy(MultiRot1D, "MakeMultiRotation1D")
id_MultiRot2D = geompy.addToStudy(MultiRot2D, "MakeMultiRotation2D")
diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py
index 64cfe0346..9d750572a 100644
--- a/src/GEOM_SWIG/geompyDC.py
+++ b/src/GEOM_SWIG/geompyDC.py
@@ -169,6 +169,7 @@
## @defgroup l3_basic_op Basic Operations
## @defgroup l3_boolean Boolean Operations
## @defgroup l3_transform Transformation Operations
+## @defgroup l3_transform_d Transformation Operations deprecated methods
## @defgroup l3_local Local Operations (Fillet, Chamfer and other Features)
## @defgroup l3_blocks_op Blocks Operations
## @defgroup l3_healing Repairing Operations
@@ -7652,7 +7653,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
## Translate the given object along the given vector a given number times
# @param theObject The object to be translated.
- # @param theVector Direction of the translation.
+ # @param theVector Direction of the translation. DX if None.
# @param theStep Distance to translate on.
# @param theNbTimes Quantity of translations to be done.
# @param theName Object name; when specified, this parameter is used
@@ -7669,7 +7670,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
Parameters:
theObject The object to be translated.
- theVector Direction of the translation.
+ theVector Direction of the translation. DX if None.
theStep Distance to translate on.
theNbTimes Quantity of translations to be done.
theName Object name; when specified, this parameter is used
@@ -7693,10 +7694,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
## Conseqently apply two specified translations to theObject specified number of times.
# @param theObject The object to be translated.
- # @param theVector1 Direction of the first translation.
+ # @param theVector1 Direction of the first translation. DX if None.
# @param theStep1 Step of the first translation.
# @param theNbTimes1 Quantity of translations to be done along theVector1.
- # @param theVector2 Direction of the second translation.
+ # @param theVector2 Direction of the second translation. DY if None.
# @param theStep2 Step of the second translation.
# @param theNbTimes2 Quantity of translations to be done along theVector2.
# @param theName Object name; when specified, this parameter is used
@@ -7714,10 +7715,10 @@ class geompyDC(GEOM._objref_GEOM_Gen):
Parameters:
theObject The object to be translated.
- theVector1 Direction of the first translation.
+ theVector1 Direction of the first translation. DX if None.
theStep1 Step of the first translation.
theNbTimes1 Quantity of translations to be done along theVector1.
- theVector2 Direction of the second translation.
+ theVector2 Direction of the second translation. DY if None.
theStep2 Step of the second translation.
theNbTimes2 Quantity of translations to be done along theVector2.
theName Object name; when specified, this parameter is used
@@ -7743,7 +7744,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
## Rotate the given object around the given axis a given number times.
# Rotation angle will be 2*PI/theNbTimes.
# @param theObject The object to be rotated.
- # @param theAxis The rotation axis.
+ # @param theAxis The rotation axis. DZ if None.
# @param theNbTimes Quantity of rotations to be done.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
@@ -7753,14 +7754,14 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# shapes, obtained after each rotation.
#
# @ref tui_multi_rotation "Example"
- def MultiRotate1D(self, theObject, theAxis, theNbTimes, theName=None):
+ def MultiRotate1DNbTimes (self, theObject, theAxis, theNbTimes, theName=None):
"""
Rotate the given object around the given axis a given number times.
Rotation angle will be 2*PI/theNbTimes.
Parameters:
theObject The object to be rotated.
- theAxis The rotation axis.
+ theAxis The rotation axis. DZ if None.
theNbTimes Quantity of rotations to be done.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
@@ -7771,26 +7772,68 @@ class geompyDC(GEOM._objref_GEOM_Gen):
shapes, obtained after each rotation.
Example of usage:
- rot1d = geompy.MultiRotate1D(prism, vect, 4)
+ rot1d = geompy.MultiRotate1DNbTimes(prism, vect, 4)
"""
# Example: see GEOM_TestAll.py
- theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
+ theNbTimes, Parameters = ParseParameters(theNbTimes)
anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
- RaiseIfFailed("MultiRotate1D", self.TrsfOp)
+ RaiseIfFailed("MultiRotate1DNbTimes", self.TrsfOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "multirotation")
return anObj
- ## Rotate the given object around the
- # given axis on the given angle a given number
- # times and multi-translate each rotation result.
+ ## Rotate the given object around the given axis
+ # a given number times on the given angle.
+ # @param theObject The object to be rotated.
+ # @param theAxis The rotation axis. DZ if None.
+ # @param theAngleStep Rotation angle in radians.
+ # @param theNbTimes Quantity of rotations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing compound of all the
+ # shapes, obtained after each rotation.
+ #
+ # @ref tui_multi_rotation "Example"
+ def MultiRotate1DByStep(self, theObject, theAxis, theAngleStep, theNbTimes, theName=None):
+ """
+ Rotate the given object around the given axis
+ a given number times on the given angle.
+
+ Parameters:
+ theObject The object to be rotated.
+ theAxis The rotation axis. DZ if None.
+ theAngleStep Rotation angle in radians.
+ theNbTimes Quantity of rotations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing compound of all the
+ shapes, obtained after each rotation.
+
+ Example of usage:
+ rot1d = geompy.MultiRotate1DByStep(prism, vect, math.pi/4, 4)
+ """
+ # Example: see GEOM_TestAll.py
+ theAngleStep, theNbTimes, Parameters = ParseParameters(theAngleStep, theNbTimes)
+ anObj = self.TrsfOp.MultiRotate1DByStep(theObject, theAxis, theAngleStep, theNbTimes)
+ RaiseIfFailed("MultiRotate1DByStep", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
+ return anObj
+
+ ## Rotate the given object around the given axis a given
+ # number times and multi-translate each rotation result.
+ # Rotation angle will be 2*PI/theNbTimes1.
# Translation direction passes through center of gravity
# of rotated shape and its projection on the rotation axis.
# @param theObject The object to be rotated.
- # @param theAxis Rotation axis.
- # @param theAngle Rotation angle in degrees.
+ # @param theAxis Rotation axis. DZ if None.
# @param theNbTimes1 Quantity of rotations to be done.
- # @param theStep Translation distance.
+ # @param theRadialStep Translation distance.
# @param theNbTimes2 Quantity of translations to be done.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
@@ -7800,7 +7843,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# shapes, obtained after each transformation.
#
# @ref tui_multi_rotation "Example"
- def MultiRotate2D(self, theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2, theName=None):
+ def MultiRotate2DNbTimes(self, theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
"""
Rotate the given object around the
given axis on the given angle a given number
@@ -7810,10 +7853,9 @@ class geompyDC(GEOM._objref_GEOM_Gen):
Parameters:
theObject The object to be rotated.
- theAxis Rotation axis.
- theAngle Rotation angle in degrees.
+ theAxis Rotation axis. DZ if None.
theNbTimes1 Quantity of rotations to be done.
- theStep Translation distance.
+ theRadialStep Translation distance.
theNbTimes2 Quantity of translations to be done.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
@@ -7827,6 +7869,163 @@ class geompyDC(GEOM._objref_GEOM_Gen):
rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
"""
# Example: see GEOM_TestAll.py
+ theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theNbTimes1, theRadialStep, theNbTimes2)
+ anObj = self.TrsfOp.MultiRotate2DNbTimes(theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2)
+ RaiseIfFailed("MultiRotate2DNbTimes", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
+ return anObj
+
+ ## Rotate the given object around the
+ # given axis on the given angle a given number
+ # times and multi-translate each rotation result.
+ # Translation direction passes through center of gravity
+ # of rotated shape and its projection on the rotation axis.
+ # @param theObject The object to be rotated.
+ # @param theAxis Rotation axis. DZ if None.
+ # @param theAngleStep Rotation angle in radians.
+ # @param theNbTimes1 Quantity of rotations to be done.
+ # @param theRadialStep Translation distance.
+ # @param theNbTimes2 Quantity of translations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing compound of all the
+ # shapes, obtained after each transformation.
+ #
+ # @ref tui_multi_rotation "Example"
+ def MultiRotate2DByStep (self, theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
+ """
+ Rotate the given object around the
+ given axis on the given angle a given number
+ times and multi-translate each rotation result.
+ Translation direction passes through center of gravity
+ of rotated shape and its projection on the rotation axis.
+
+ Parameters:
+ theObject The object to be rotated.
+ theAxis Rotation axis. DZ if None.
+ theAngleStep Rotation angle in radians.
+ theNbTimes1 Quantity of rotations to be done.
+ theRadialStep Translation distance.
+ theNbTimes2 Quantity of translations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing compound of all the
+ shapes, obtained after each transformation.
+
+ Example of usage:
+ rot2d = geompy.MultiRotate2D(prism, vect, math.pi/3, 4, 50, 5)
+ """
+ # Example: see GEOM_TestAll.py
+ theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
+ anObj = self.TrsfOp.MultiRotate2DByStep(theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
+ RaiseIfFailed("MultiRotate2DByStep", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
+ return anObj
+
+ ## The same, as MultiRotate1DNbTimes(), but axis is given by direction and point
+ #
+ # @ref swig_MakeMultiRotation "Example"
+ def MakeMultiRotation1DNbTimes(self, aShape, aDir, aPoint, aNbTimes, theName=None):
+ """
+ The same, as geompy.MultiRotate1DNbTimes, but axis is given by direction and point
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot1D = geompy.MakeMultiRotation1DNbTimes(prism, vy, pz, 6)
+ """
+ # Example: see GEOM_TestOthers.py
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate1D()
+ anObj = self.MultiRotate1DNbTimes(aShape, aVec, aNbTimes, theName)
+ return anObj
+
+ ## The same, as MultiRotate1DByStep(), but axis is given by direction and point
+ #
+ # @ref swig_MakeMultiRotation "Example"
+ def MakeMultiRotation1DByStep(self, aShape, aDir, aPoint, anAngle, aNbTimes, theName=None):
+ """
+ The same, as geompy.MultiRotate1D, but axis is given by direction and point
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot1D = geompy.MakeMultiRotation1DByStep(prism, vy, pz, math.pi/3, 6)
+ """
+ # Example: see GEOM_TestOthers.py
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate1D()
+ anObj = self.MultiRotate1DByStep(aShape, aVec, anAngle, aNbTimes, theName)
+ return anObj
+
+ ## The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
+ #
+ # @ref swig_MakeMultiRotation "Example"
+ def MakeMultiRotation2DNbTimes(self, aShape, aDir, aPoint, nbtimes1, aStep, nbtimes2, theName=None):
+ """
+ The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot2D = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 6, 30, 3)
+ """
+ # Example: see GEOM_TestOthers.py
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate2DNbTimes()
+ anObj = self.MultiRotate2DNbTimes(aShape, aVec, nbtimes1, aStep, nbtimes2, theName)
+ return anObj
+
+ ## The same, as MultiRotate2DByStep(), but axis is given by direction and point
+ #
+ # @ref swig_MakeMultiRotation "Example"
+ def MakeMultiRotation2DByStep(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
+ """
+ The same, as MultiRotate2DByStep(), but axis is given by direction and point
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot2D = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4, 6, 30, 3)
+ """
+ # Example: see GEOM_TestOthers.py
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate2D()
+ anObj = self.MultiRotate2DByStep(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
+ return anObj
+
+ # end of l3_transform
+ ## @}
+
+ ## @addtogroup l3_transform_d
+ ## @{
+
+ ## Deprecated method. Use MultiRotate1DNbTimes instead.
+ def MultiRotate1D(self, theObject, theAxis, theNbTimes, theName=None):
+ """
+ Deprecated method. Use MultiRotate1DNbTimes instead.
+ """
+ print "The method MultiRotate1D is DEPRECATED. Use MultiRotate1DNbTimes instead."
+ return self.MultiRotate1DNbTimes(theObject, theAxis, theNbTimes, theName)
+
+ ## The same, as MultiRotate2DByStep(), but theAngle is in degrees.
+ # This method is DEPRECATED. Use MultiRotate2DByStep() instead.
+ def MultiRotate2D(self, theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2, theName=None):
+ """
+ The same, as MultiRotate2DByStep(), but theAngle is in degrees.
+ This method is DEPRECATED. Use MultiRotate2DByStep() instead.
+
+ Example of usage:
+ rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
+ """
+ print "The method MultiRotate2D is DEPRECATED. Use MultiRotate2DByStep instead."
theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
RaiseIfFailed("MultiRotate2D", self.TrsfOp)
@@ -7835,42 +8034,42 @@ class geompyDC(GEOM._objref_GEOM_Gen):
return anObj
## The same, as MultiRotate1D(), but axis is given by direction and point
- #
- # @ref swig_MakeMultiRotation "Example"
+ # This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
def MakeMultiRotation1D(self, aShape, aDir, aPoint, aNbTimes, theName=None):
"""
- The same, as geompy.MultiRotate1D, but axis is given by direction and point
+ The same, as geompy.MultiRotate1D, but axis is given by direction and point.
+ This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
Example of usage:
pz = geompy.MakeVertex(0, 0, 100)
vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6)
"""
- # Example: see GEOM_TestOthers.py
+ print "The method MakeMultiRotation1D is DEPRECATED. Use MakeMultiRotation1DNbTimes instead."
aVec = self.MakeLine(aPoint,aDir)
# note: auto-publishing is done in self.MultiRotate1D()
anObj = self.MultiRotate1D(aShape, aVec, aNbTimes, theName)
return anObj
## The same, as MultiRotate2D(), but axis is given by direction and point
- #
- # @ref swig_MakeMultiRotation "Example"
+ # This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
def MakeMultiRotation2D(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
"""
The same, as MultiRotate2D(), but axis is given by direction and point
+ This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
Example of usage:
pz = geompy.MakeVertex(0, 0, 100)
vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
"""
- # Example: see GEOM_TestOthers.py
+ print "The method MakeMultiRotation2D is DEPRECATED. Use MakeMultiRotation2DByStep instead."
aVec = self.MakeLine(aPoint,aDir)
# note: auto-publishing is done in self.MultiRotate2D()
anObj = self.MultiRotate2D(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
return anObj
- # end of l3_transform
+ # end of l3_transform_d
## @}
## @addtogroup l3_local
diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx
index 062b94d7f..790c0a41c 100644
--- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx
+++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx
@@ -162,7 +162,7 @@ void MeasureGUI_BndBoxDlg::ActivateThisDialog()
this, SLOT(SelectionIntoArgument()));
globalSelection();
- displayPreview(true);
+ redisplayPreview();
}
//=================================================================================
diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx
index ffd630a9a..d0d9fda91 100644
--- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx
+++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx
@@ -18,12 +18,11 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : MeasureGUI_DistanceDlg.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
#include "MeasureGUI_DistanceDlg.h"
#include "MeasureGUI_Widgets.h"
@@ -36,6 +35,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -61,7 +61,7 @@
// true to construct a modal dialog.
//=================================================================================
MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* parent)
- : MeasureGUI_Skeleton(GUI, parent)
+ : GEOMBase_Skeleton(GUI, parent)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MINDIST")));
@@ -72,8 +72,12 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* paren
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DISTANCE"));
mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
- myGrp = new MeasureGUI_2Sel4LineEdit(centralWidget());
+ myGrp = new MeasureGUI_2Sel4LineEdit (centralWidget());
myGrp->GroupBox1->setTitle(tr("GEOM_MINDIST_OBJ"));
myGrp->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
myGrp->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
@@ -90,12 +94,12 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* paren
myGrp->LineEdit5->setReadOnly(true);
myGrp->LineEdit6->setReadOnly(true);
- QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ QVBoxLayout* layout = new QVBoxLayout (centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(myGrp);
/***************************************************************/
- myHelpFileName = "using_measurement_tools_page.html#min_distance_anchor";
+ myHelpFileName = "min_distance_page.html";
// Initialisation
Init();
@@ -115,21 +119,69 @@ MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg()
//=================================================================================
void MeasureGUI_DistanceDlg::Init()
{
- // init variables
- myGrp->LineEdit1->setText("");
- myGrp->LineEdit2->setText("");
- myObj = myObj2 = GEOM::GEOM_Object::_nil();
-
- mySelBtn = myGrp->PushButton1;
- mySelEdit = myGrp->LineEdit1;
-
myEditCurrentArgument = myGrp->LineEdit1;
// signals and slots connections
- connect(myGrp->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ connect(myGrp->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(myGrp->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- MeasureGUI_Skeleton::Init();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ initName(tr("GEOM_DISTANCE"));
+ globalSelection();
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::ClickOnOk()
+{
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool MeasureGUI_DistanceDlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
+
+ initName();
+ return true;
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ globalSelection();
+ redisplayPreview();
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::enterEvent(QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
}
//=================================================================================
@@ -145,7 +197,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() > 0) {
- aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
+ aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
}
// clear selection
@@ -155,82 +207,19 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
this, SLOT(SelectionIntoArgument()));
if (myEditCurrentArgument == myGrp->LineEdit1) {
- myObj = aSelectedObject;
- if (!myObj->_is_nil() && myObj2->_is_nil())
+ myObj1 = aSelectedObject;
+ if (!myObj1->_is_nil() && myObj2->_is_nil())
myGrp->PushButton2->click();
}
else {
myObj2 = aSelectedObject;
- if (!myObj2->_is_nil() && myObj->_is_nil())
+ if (!myObj2->_is_nil() && myObj1->_is_nil())
myGrp->PushButton1->click();
}
processObject();
}
-//=================================================================================
-// function : processObject()
-// purpose : Fill dialogs fields in accordance with myObj and myObj2
-//=================================================================================
-void MeasureGUI_DistanceDlg::processObject()
-{
- myGrp->LineEdit1->setText(!myObj->_is_nil() ? GEOMBase::GetName(myObj ) : "");
- myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
-
- gp_Pnt aPnt1, aPnt2;
- double aDist = 0.;
- if (getParameters(aDist, aPnt1, aPnt2)) {
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
-
- myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist, aPrecision));
-
- gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ();
- myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X(), aPrecision));
- myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y(), aPrecision));
- myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z(), aPrecision));
-
- redisplayPreview();
- }
- else {
- myGrp->LineEdit3->setText("");
- myGrp->LineEdit4->setText("");
- myGrp->LineEdit5->setText("");
- myGrp->LineEdit6->setText("");
- erasePreview();
- }
-}
-
-//=================================================================================
-// function : getParameters()
-// purpose : Get distance between objects
-//=================================================================================
-bool MeasureGUI_DistanceDlg::getParameters (double& theDistance,
- gp_Pnt& thePnt1,
- gp_Pnt& thePnt2)
-{
- QString msg;
- if (isValid(msg)) {
- GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
-
- try {
- double x1, y1, z1, x2, y2, z2;
- theDistance = anOper->GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2);
-
- thePnt1.SetCoord(x1, y1, z1);
- thePnt2.SetCoord(x2, y2, z2);
- }
- catch(const SALOME::SALOME_Exception& e) {
- SalomeApp_Tools::QtCatchCorbaException(e);
- return false;
- }
-
- return anOper->IsDone();
- }
-
- return false;
-}
-
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
@@ -263,23 +252,64 @@ void MeasureGUI_DistanceDlg::SetEditCurrentArgument()
}
//=================================================================================
-// function : LineEditReturnPressed()
-// purpose :
+// function : processObject()
+// purpose : Fill dialogs fields in accordance with myObj1 and myObj2
//=================================================================================
-void MeasureGUI_DistanceDlg::LineEditReturnPressed()
+void MeasureGUI_DistanceDlg::processObject()
{
- QLineEdit* send = (QLineEdit*)sender();
+ myGrp->LineEdit1->setText(!myObj1->_is_nil() ? GEOMBase::GetName(myObj1) : "");
+ myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
- if (send == myGrp->LineEdit1 || send == myGrp->LineEdit2) {
- myEditCurrentArgument = send;
+ gp_Pnt aPnt1, aPnt2;
+ double aDist = 0.;
+ if (getParameters(aDist, aPnt1, aPnt2)) {
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
+ myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist, aPrecision));
- if (GEOMBase::SelectionByNameInDialogs(this, myGrp->LineEdit1->text(), aSelList))
- myGrp->LineEdit1->setText(myGrp->LineEdit1->text());
+ gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ();
+ myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X(), aPrecision));
+ myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y(), aPrecision));
+ myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z(), aPrecision));
+
+ redisplayPreview();
}
+ else {
+ myGrp->LineEdit3->setText("");
+ myGrp->LineEdit4->setText("");
+ myGrp->LineEdit5->setText("");
+ myGrp->LineEdit6->setText("");
+ erasePreview();
+ }
+}
+
+//=================================================================================
+// function : getParameters()
+// purpose : Get distance between objects
+//=================================================================================
+bool MeasureGUI_DistanceDlg::getParameters (double& theDistance, gp_Pnt& thePnt1, gp_Pnt& thePnt2)
+{
+ QString msg;
+ if (isValid(msg)) {
+ GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+
+ try {
+ double x1, y1, z1, x2, y2, z2;
+ theDistance = anOper->GetMinDistance(myObj1, myObj2, x1, y1, z1, x2, y2, z2);
+
+ thePnt1.SetCoord(x1, y1, z1);
+ thePnt2.SetCoord(x2, y2, z2);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ return false;
+ }
+
+ return anOper->IsDone();
+ }
+
+ return false;
}
//=================================================================================
@@ -289,46 +319,47 @@ void MeasureGUI_DistanceDlg::LineEditReturnPressed()
SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
{
double aDist = 0.;
- gp_Pnt aPnt1(0, 0, 0), aPnt2(0, 0, 0);
+ gp_Pnt aPnt1 (0, 0, 0), aPnt2 (0, 0, 0);
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
- if (myObj->_is_nil() || myObj2->_is_nil() ||
- !getParameters(aDist, aPnt1, aPnt2) ||
- vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
+ if (myObj1->_is_nil() || myObj2->_is_nil() ||
+ !getParameters(aDist, aPnt1, aPnt2) ||
+ vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
return 0;
try
{
if (aDist <= 1.e-9) {
- BRepBuilderAPI_MakeVertex aMaker(aPnt1);
+ BRepBuilderAPI_MakeVertex aMaker (aPnt1);
return getDisplayer()->BuildPrs(aMaker.Vertex());
}
else {
- BRepBuilderAPI_MakeEdge MakeEdge(aPnt1, aPnt2);
+ BRepBuilderAPI_MakeEdge MakeEdge (aPnt1, aPnt2);
TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(aPnt1);
TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(aPnt2);
QString aLabel;
aLabel.sprintf("%.1f", aDist);
- gp_Pnt aPnt3((aPnt1.X() + aPnt2.X()) / 2,
+ gp_Pnt aPnt3 ((aPnt1.X() + aPnt2.X()) / 2,
(aPnt1.Y() + aPnt2.Y()) / 2,
(aPnt1.Z() + aPnt2.Z()) / 2);
- gp_Vec va(aPnt3, aPnt1);
- gp_Vec vb(aPnt3, aPnt2);
+ gp_Vec va (aPnt3, aPnt1);
+ gp_Vec vb (aPnt3, aPnt2);
if (va.IsParallel(vb, Precision::Angular())) {
aPnt3.SetY((aPnt1.Y() + aPnt2.Y()) / 2 + 100);
aPnt3.SetZ((aPnt1.Z() + aPnt2.Z()) / 2);
}
- gce_MakePln gce_MP(aPnt1, aPnt2, aPnt3);
- Handle(Geom_Plane) P = new Geom_Plane(gce_MP.Value());
+ gce_MakePln gce_MP (aPnt1, aPnt2, aPnt3);
+ Handle(Geom_Plane) P = new Geom_Plane (gce_MP.Value());
- Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension(
- aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
+ Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension
+ (aVert1, aVert2, P, aDist,
+ TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
anIO->SetArrowSize(aDist/20);
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -345,16 +376,76 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
return aPrs;
}
}
- catch(Standard_Failure) {
+ catch (Standard_Failure) {
return 0;
}
}
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_DistanceDlg::createOperation()
+{
+ return getGeomEngine()->GetIMeasureOperations(getStudyId());
+}
+
//=================================================================================
// function : isValid()
// purpose :
//=================================================================================
bool MeasureGUI_DistanceDlg::isValid (QString& msg)
{
- return MeasureGUI_Skeleton::isValid(msg) && !myObj2->_is_nil();
+ return !myObj1->_is_nil() && !myObj2->_is_nil();
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool MeasureGUI_DistanceDlg::execute (ObjectList& objects)
+{
+ GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+ GEOM::GEOM_IBasicOperations_var aBasicOper = getGeomEngine()->GetIBasicOperations(getStudyId());
+
+ double x1, y1, z1, x2, y2, z2;
+ double aDist = anOper->GetMinDistance(myObj1, myObj2, x1, y1, z1, x2, y2, z2);
+
+ GEOM::GEOM_Object_var anObj1 = aBasicOper->MakePointXYZ(x1, y1, z1);
+ GEOM::GEOM_Object_var anObj2 = aBasicOper->MakePointXYZ(x2, y2, z2);
+
+ if (!anObj1->_is_nil() && !anObj2->_is_nil()) {
+ objects.push_back(anObj1._retn());
+ objects.push_back(anObj2._retn());
+ }
+
+ return true;
+}
+
+//=================================================================================
+// function : redisplayPreview()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::redisplayPreview()
+{
+ QString aMess;
+ if (!isValid(aMess)) {
+ erasePreview(true);
+ return;
+ }
+
+ erasePreview(false);
+
+ try {
+ SUIT_OverrideCursor();
+
+ getDisplayer()->SetColor(Quantity_NOC_VIOLET);
+ getDisplayer()->SetToActivate(false);
+
+ if (SALOME_Prs* aPrs = buildPrs())
+ displayPreview(aPrs);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ }
}
diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.h b/src/MeasureGUI/MeasureGUI_DistanceDlg.h
index 2c4e9c56d..83a44272c 100644
--- a/src/MeasureGUI/MeasureGUI_DistanceDlg.h
+++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.h
@@ -18,16 +18,15 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : MeasureGUI_DistanceDlg.h
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
#ifndef MEASUREGUI_DISTANCEDLG_H
#define MEASUREGUI_DISTANCEDLG_H
-#include "MeasureGUI_Skeleton.h"
+#include
class MeasureGUI_2Sel4LineEdit;
class gp_Pnt;
@@ -36,36 +35,41 @@ class gp_Pnt;
// class : MeasureGUI_DistanceDlg
// purpose :
//=================================================================================
-
-class MeasureGUI_DistanceDlg : public MeasureGUI_Skeleton
-{
+class MeasureGUI_DistanceDlg : public GEOMBase_Skeleton
+{
Q_OBJECT
-
+
public:
- MeasureGUI_DistanceDlg( GeometryGUI*, QWidget* );
+ MeasureGUI_DistanceDlg (GeometryGUI*, QWidget*);
~MeasureGUI_DistanceDlg();
protected:
- // redefined from GEOMBase_Helper and MeasureGUI_Skeleton
+ // redefined from GEOMBase_Helper and GEOMBase_Skeleton
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
+
+ void redisplayPreview();
virtual void processObject();
virtual SALOME_Prs* buildPrs();
- virtual void SelectionIntoArgument();
- virtual void LineEditReturnPressed();
- virtual void SetEditCurrentArgument();
- virtual bool isValid( QString& );
private:
void Init();
- bool getParameters( double&,
- gp_Pnt&,
- gp_Pnt& );
+ void enterEvent (QEvent*);
+ bool getParameters (double&, gp_Pnt&, gp_Pnt&);
+
private:
- QLineEdit* myEditCurrentArgument;
- QLineEdit* mySelEdit2;
- QPushButton* mySelBtn2;
-
- MeasureGUI_2Sel4LineEdit* myGrp;
+ GEOM::GEOM_Object_var myObj1;
GEOM::GEOM_Object_var myObj2;
+
+ MeasureGUI_2Sel4LineEdit* myGrp;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
};
#endif // MEASUREGUI_DISTANCEDLG_H
diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx
index f450a2f8c..5a0fd01f3 100644
--- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx
+++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx
@@ -69,34 +69,29 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
- GroupPoints = new DlgRef_2Sel1SpinInt(centralWidget());
- GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
- GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
- GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
- GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES"));
- GroupPoints->PushButton1->setIcon(image2);
- GroupPoints->PushButton2->setIcon(image2);
- GroupPoints->LineEdit1->setReadOnly(true);
- GroupPoints->LineEdit2->setReadOnly(true);
+ bool isAngleStep = true;
- GroupDimensions = new DlgRef_2Sel4Spin1Check(centralWidget());
- GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
- GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
- GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR"));
- GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
- GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES"));
- GroupDimensions->TextLabel5->setText(tr("GEOM_STEP"));
- GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES"));
- GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE"));
- GroupDimensions->PushButton1->setIcon(image2);
- GroupDimensions->PushButton2->setIcon(image2);
- GroupDimensions->LineEdit1->setReadOnly(true);
- GroupDimensions->LineEdit2->setReadOnly(true);
+ GroupArgs = new TransformationGUI_2Sel4Spin1Check (centralWidget());
+ GroupArgs->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
+ GroupArgs->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
+ GroupArgs->TextLabel2->setText(tr("GEOM_VECTOR"));
+ //GroupArgs->TextLabel3->setText(tr("GEOM_ANGLE_STEP"));
+ GroupArgs->CheckAngleStep->setText(tr("GEOM_ANGLE_STEP"));
+ GroupArgs->CheckAngleStep->setChecked(isAngleStep);
+ GroupArgs->TextLabel4->setText(tr("GEOM_NB_TIMES"));
+ GroupArgs->TextLabel5->setText(tr("GEOM_STEP_R"));
+ GroupArgs->TextLabel6->setText(tr("GEOM_NB_TIMES"));
+ GroupArgs->CheckButton1->setText(tr("GEOM_REVERSE"));
+ GroupArgs->PushButton1->setIcon(image2);
+ GroupArgs->PushButton2->setIcon(image2);
+ GroupArgs->LineEdit1->setReadOnly(true);
+ GroupArgs->LineEdit2->setReadOnly(true);
+ GroupArgs->SpinBox_DX1->setEnabled(isAngleStep);
+ GroupArgs->CheckButton1->setEnabled(isAngleStep);
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
- layout->addWidget(GroupPoints);
- layout->addWidget(GroupDimensions);
+ layout->addWidget(GroupArgs);
/***************************************************************/
setHelpFileName("multi_rotation_operation_page.html");
@@ -119,38 +114,23 @@ TransformationGUI_MultiRotationDlg::~TransformationGUI_MultiRotationDlg()
//=================================================================================
void TransformationGUI_MultiRotationDlg::Init()
{
+ // init variables
+ myAng = 45.0;
+ myStep = 50.0;
+ myNbTimes1 = myNbTimes2 = 3;
+
// Get setting of step value from file configuration
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
int SpecificStep1 = 5;
int SpecificStep2 = 1;
- // init variables
- myAng = 45.0;
- myStep = 50.0;
- myNbTimes1 = myNbTimes2 = 2;
// min, max, step and decimals for spin boxes & initial values
- initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2);
- GroupPoints->SpinBox_DX->setValue(myNbTimes1);
-
- initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision" );
- initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep2);
- initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step,"length_precision" );
- initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep2);
- GroupDimensions->SpinBox_DX1->setValue(myAng);
- GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
- GroupDimensions->SpinBox_DX2->setValue(myStep);
- GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
-
- GroupPoints->LineEdit1->setText("");
- GroupPoints->LineEdit2->setText("");
-
- GroupDimensions->LineEdit1->setText("");
- GroupDimensions->LineEdit2->setText("");
-
- myBase.nullify();
- myVector.nullify();
+ initSpinBox(GroupArgs->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision");
+ initSpinBox(GroupArgs->SpinBox_DY1, 1, 999, SpecificStep2);
+ initSpinBox(GroupArgs->SpinBox_DX2, COORD_MIN, COORD_MAX, step, "length_precision");
+ initSpinBox(GroupArgs->SpinBox_DY2, 1, 999, SpecificStep2);
mainFrame()->GroupBoxPublish->show();
@@ -158,25 +138,23 @@ void TransformationGUI_MultiRotationDlg::Init()
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
- connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupArgs->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupArgs->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
- connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
- connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
+ connect(GroupArgs->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupArgs->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
+ connect(GroupArgs->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupArgs->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
- connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )),
- this, SLOT(TextValueChangedInSpinBox( const QString& )));
+ connect(GroupArgs->SpinBox_DX1, SIGNAL(textChanged(const QString&)),
+ this, SLOT(TextValueChangedInSpinBox(const QString&)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
- connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
+ connect(GroupArgs->CheckAngleStep, SIGNAL(toggled(bool)), this, SLOT(CheckAngleStep(bool)));
+ connect(GroupArgs->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
initName(tr("GEOM_MULTIROTATION"));
@@ -189,13 +167,7 @@ void TransformationGUI_MultiRotationDlg::Init()
//=================================================================================
void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step)
{
- GroupDimensions->SpinBox_DX2->setSingleStep(step);
-
- // san: Commented so as not to override specific step settings
- //GroupPoints->SpinBox_DX->setSingleStep((int)step);
- //GroupDimensions->SpinBox_DX1->setSingleStep(step);
- //GroupDimensions->SpinBox_DY1->setSingleStep((int)step);
- //GroupDimensions->SpinBox_DY2->setSingleStep((int)step);
+ GroupArgs->SpinBox_DX2->setSingleStep(step);
}
//=================================================================================
@@ -206,42 +178,42 @@ void TransformationGUI_MultiRotationDlg::ConstructorsClicked (int constructorId)
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myBase.nullify();
+ myVector.nullify();
+
+ GroupArgs->LineEdit1->setText("");
+ GroupArgs->LineEdit2->setText("");
+
+ GroupArgs->SpinBox_DX1->setValue(myAng);
+ GroupArgs->SpinBox_DY1->setValue(myNbTimes1);
+ GroupArgs->SpinBox_DX2->setValue(myStep);
+ GroupArgs->SpinBox_DY2->setValue(myNbTimes2);
+
switch (constructorId) {
case 0: // Rotate simple
{
- GroupDimensions->hide();
- GroupPoints->show();
-
- GroupPoints->LineEdit1->setText("");
- GroupPoints->LineEdit2->setText("");
- myBase.nullify();
- myVector.nullify();
-
- GroupPoints->SpinBox_DX->setValue(myNbTimes1);
-
- GroupPoints->PushButton1->click();
+ GroupArgs->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
+ GroupArgs->TextLabel5->hide();
+ GroupArgs->TextLabel6->hide();
+ GroupArgs->SpinBox_DX2->hide();
+ GroupArgs->SpinBox_DY2->hide();
+ GroupArgs->CheckButton1->hide();
}
break;
case 1: // Rotate double
{
- GroupPoints->hide();
- GroupDimensions->show();
-
- GroupDimensions->LineEdit1->setText("");
- GroupDimensions->LineEdit2->setText("");
- myBase.nullify();
- myVector.nullify();
-
- GroupDimensions->SpinBox_DX1->setValue(myAng);
- GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
- GroupDimensions->SpinBox_DX2->setValue(myStep);
- GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
-
- GroupDimensions->PushButton1->click();
+ GroupArgs->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
+ GroupArgs->TextLabel5->show();
+ GroupArgs->TextLabel6->show();
+ GroupArgs->SpinBox_DX2->show();
+ GroupArgs->SpinBox_DY2->show();
+ GroupArgs->CheckButton1->show();
}
break;
}
+ GroupArgs->PushButton1->click();
+
qApp->processEvents();
updateGeometry();
resize(minimumSizeHint());
@@ -289,33 +261,39 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
{
erasePreview();
- TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
- myEditCurrentArgument == GroupDimensions->LineEdit2 ) ?
+ TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupArgs->LineEdit2 ) ?
TopAbs_EDGE : TopAbs_SHAPE;
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
TopoDS_Shape aShape;
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
QString aName = GEOMBase::GetName( aSelectedObject.get() );
myEditCurrentArgument->setText( aName );
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
+ if ( myEditCurrentArgument == GroupArgs->LineEdit1 ) {
myBase = aSelectedObject;
+
+ // recompute myAng and myStep (Mantis issue 0021718)
+ GEOM::GEOM_IMeasureOperations_var anOper = getGeomEngine()->GetIMeasureOperations(getStudyId());
+ double Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
+ anOper->GetBoundingBox(myBase.get(), Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
+ if (anOper->IsDone()) {
+ // angular step
+ double diag = sqrt((Xmax-Xmin)*(Xmax-Xmin) + (Ymax-Ymin)*(Ymax-Ymin));
+ double d = sqrt((0.5*(Xmax+Xmin))*(0.5*(Xmax+Xmin)) + (0.5*(Ymax+Ymin))*(0.5*(Ymax+Ymin)));
+ myAng = floor(2.0 * atan(diag/d) * 180.0 / M_PI);
+ GroupArgs->SpinBox_DX1->setValue(myAng);
+
+ // radial step
+ myStep = Max(floor(1.5*(Xmax-Xmin)), floor(1.5*(Ymax-Ymin)));
+ GroupArgs->SpinBox_DX2->setValue(myStep);
+ }
+
if ( !myVector )
- GroupPoints->PushButton2->click();
+ GroupArgs->PushButton2->click();
}
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2) {
+ else if ( myEditCurrentArgument == GroupArgs->LineEdit2 ) {
myVector = aSelectedObject;
if ( !myBase )
- GroupPoints->PushButton1->click();
- }
- else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) {
- myBase = aSelectedObject;
- if ( !myVector )
- GroupDimensions->PushButton2->click();
- }
- else if ( myEditCurrentArgument == GroupDimensions->LineEdit2 ) {
- myVector = aSelectedObject;
- if ( !myBase )
- GroupDimensions->PushButton1->click();
+ GroupArgs->PushButton1->click();
}
// clear selection
@@ -325,11 +303,9 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
this, SLOT(SelectionIntoArgument()));
}
else {
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
- myEditCurrentArgument == GroupDimensions->LineEdit1 )
+ if ( myEditCurrentArgument == GroupArgs->LineEdit1 )
myBase.nullify();
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
- myEditCurrentArgument == GroupDimensions->LineEdit2 )
+ else if ( myEditCurrentArgument == GroupArgs->LineEdit2 )
myVector.nullify();
myEditCurrentArgument->setText("");
}
@@ -348,33 +324,19 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection(GEOM_ALLSHAPES);
- if (send == GroupPoints->PushButton1) {
- myEditCurrentArgument = GroupPoints->LineEdit1;
+ if (send == GroupArgs->PushButton1) {
+ myEditCurrentArgument = GroupArgs->LineEdit1;
- GroupPoints->PushButton2->setDown(false);
- GroupPoints->LineEdit2->setEnabled(false);
+ GroupArgs->PushButton2->setDown(false);
+ GroupArgs->LineEdit2->setEnabled(false);
}
- else if (send == GroupPoints->PushButton2) {
- myEditCurrentArgument = GroupPoints->LineEdit2;
+ else if (send == GroupArgs->PushButton2) {
+ myEditCurrentArgument = GroupArgs->LineEdit2;
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
- GroupPoints->PushButton1->setDown(false);
- GroupPoints->LineEdit1->setEnabled(false);
- }
- else if (send == GroupDimensions->PushButton1) {
- myEditCurrentArgument = GroupDimensions->LineEdit1;
-
- GroupDimensions->PushButton2->setDown(false);
- GroupDimensions->LineEdit2->setEnabled(false);
- }
- else if (send == GroupDimensions->PushButton2) {
- myEditCurrentArgument = GroupDimensions->LineEdit2;
-
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
-
- GroupDimensions->PushButton1->setDown(false);
- GroupDimensions->LineEdit1->setEnabled(false);
+ GroupArgs->PushButton1->setDown(false);
+ GroupArgs->LineEdit1->setEnabled(false);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
@@ -416,12 +378,13 @@ void TransformationGUI_MultiRotationDlg::enterEvent (QEvent*)
// function : TextValueChangedInSpinBox()
// purpose :
//=================================================================================
-void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString& s){
+void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox (const QString& s)
+{
bool isDigit;
s.toDouble(&isDigit);
- if(!isDigit)
- GroupDimensions->CheckButton1->setChecked(false);
- GroupDimensions->CheckButton1->setEnabled(isDigit);
+ if (!isDigit)
+ GroupArgs->CheckButton1->setChecked(false);
+ GroupArgs->CheckButton1->setEnabled(isDigit);
}
//=================================================================================
@@ -432,9 +395,9 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (double newValue)
{
QObject* send = (QObject*)sender();
- if (send == GroupDimensions->SpinBox_DX1)
+ if (send == GroupArgs->SpinBox_DX1)
myAng = newValue;
- else if (send == GroupDimensions->SpinBox_DX2)
+ else if (send == GroupArgs->SpinBox_DX2)
myStep = newValue;
processPreview();
@@ -448,9 +411,9 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (int newValue)
{
QObject* send = (QObject*)sender();
- if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
+ if (send == GroupArgs->SpinBox_DY1)
myNbTimes1 = newValue;
- else if (send == GroupDimensions->SpinBox_DY2)
+ else if (send == GroupArgs->SpinBox_DY2)
myNbTimes2 = newValue;
processPreview();
@@ -458,7 +421,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox (int newValue)
//=================================================================================
// function : ReverseAngle()
-// purpose : 'state' not used here
+// purpose :
//=================================================================================
void TransformationGUI_MultiRotationDlg::ReverseAngle()
{
@@ -467,11 +430,22 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle()
int aConstructorId = getConstructorId();
if (aConstructorId == 1)
- GroupDimensions->SpinBox_DX1->setValue(myAng);
+ GroupArgs->SpinBox_DX1->setValue(myAng);
processPreview();
}
+//=================================================================================
+// function : CheckAngleStep()
+// purpose :
+//=================================================================================
+void TransformationGUI_MultiRotationDlg::CheckAngleStep (bool isOn)
+{
+ GroupArgs->SpinBox_DX1->setEnabled(isOn);
+ GroupArgs->CheckButton1->setEnabled(isOn);
+ processPreview();
+}
+
//=================================================================================
// function : createOperation
// purpose :
@@ -488,16 +462,20 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiRotationDlg::createOperation()
bool TransformationGUI_MultiRotationDlg::isValid (QString& msg)
{
bool ok = false;
- switch(getConstructorId()){
+ switch (getConstructorId()) {
case 0:
- ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && myBase && myVector;
+ ok = (GroupArgs->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
+ //myBase && myVector); // myVector = DZ by default
+ myBase);
break;
case 1:
- ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
- GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
- GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
- GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
- myBase && myVector;
+ ok = (GroupArgs->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
+ //myBase && myVector); // myVector = DZ by default
+ myBase);
break;
default:
break;
@@ -520,29 +498,38 @@ bool TransformationGUI_MultiRotationDlg::execute (ObjectList& objects)
switch (getConstructorId()) {
case 0:
- if ( myBase && myVector ) {
+ if (GroupArgs->CheckAngleStep->isChecked())
+ anObj = anOper->MultiRotate1DByStep(myBase.get(), myVector.get(), myAng * M_PI / 180., myNbTimes1);
+ else
anObj = anOper->MultiRotate1D(myBase.get(), myVector.get(), myNbTimes1);
- if(!IsPreview())
- aParameters<SpinBox_DX->text();
- res = true;
+
+ if (!IsPreview()) {
+ if (GroupArgs->CheckAngleStep->isChecked())
+ aParameters << GroupArgs->SpinBox_DX1->text();
+ aParameters << GroupArgs->SpinBox_DY1->text();
}
+ res = true;
break;
case 1:
- if ( myBase && myVector ) {
- anObj = anOper->MultiRotate2D(myBase.get(), myVector.get(), myAng, myNbTimes1, myStep, myNbTimes2);
- if(!IsPreview()) {
- aParameters<SpinBox_DX1->text();
- aParameters<SpinBox_DY1->text();
- aParameters<SpinBox_DX2->text();
- aParameters<SpinBox_DY2->text();
- }
- res = true;
+ if (GroupArgs->CheckAngleStep->isChecked())
+ anObj = anOper->MultiRotate2DByStep(myBase.get(), myVector.get(), myAng * M_PI / 180., myNbTimes1,
+ myStep, myNbTimes2);
+ else
+ anObj = anOper->MultiRotate2DNbTimes(myBase.get(), myVector.get(), myNbTimes1, myStep, myNbTimes2);
+
+ if (!IsPreview()) {
+ if (GroupArgs->CheckAngleStep->isChecked())
+ aParameters << GroupArgs->SpinBox_DX1->text();
+ aParameters << GroupArgs->SpinBox_DY1->text();
+ aParameters << GroupArgs->SpinBox_DX2->text();
+ aParameters << GroupArgs->SpinBox_DY2->text();
}
+ res = true;
break;
}
if (!anObj->_is_nil()) {
- if(!IsPreview())
+ if (!IsPreview())
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}
@@ -586,3 +573,82 @@ void TransformationGUI_MultiRotationDlg::restoreSubShapes (SALOMEDS::Study_ptr
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}
+
+//=================================================================================
+// function : TransformationGUI_2Sel4Spin1Check
+// purpose :
+//=================================================================================
+TransformationGUI_2Sel4Spin1Check::TransformationGUI_2Sel4Spin1Check (QWidget *parent)
+{
+ gridLayout = new QGridLayout (parent);
+ gridLayout->setSpacing(6);
+ gridLayout->setContentsMargins(11, 11, 11, 11);
+ gridLayout->setHorizontalSpacing(0);
+ gridLayout->setVerticalSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
+
+ GroupBox1 = new QGroupBox (parent);
+
+ gridLayout1 = new QGridLayout (GroupBox1);
+ gridLayout1->setSpacing(6);
+ gridLayout1->setContentsMargins(11, 11, 11, 11);
+ gridLayout1->setHorizontalSpacing(6);
+ gridLayout1->setVerticalSpacing(6);
+ gridLayout1->setContentsMargins(9, 9, 9, 9);
+
+ // 2Sel
+ TextLabel1 = new QLabel(GroupBox1);
+ TextLabel2 = new QLabel(GroupBox1);
+
+ PushButton1 = new QPushButton (GroupBox1);
+ PushButton2 = new QPushButton (GroupBox1);
+
+ LineEdit2 = new QLineEdit(GroupBox1);
+ LineEdit1 = new QLineEdit(GroupBox1);
+
+ gridLayout1->addWidget(TextLabel1, 0, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel2, 1, 0, 1, 1);
+ gridLayout1->addWidget(PushButton1, 0, 1, 1, 1);
+ gridLayout1->addWidget(PushButton2, 1, 1, 1, 1);
+ gridLayout1->addWidget(LineEdit1, 0, 2, 1, 1);
+ gridLayout1->addWidget(LineEdit2, 1, 2, 1, 1);
+
+ // 4Spin (double-int-double-int)
+ //TextLabel3 = new QLabel (GroupBox1);
+ CheckAngleStep = new QCheckBox (GroupBox1);
+ TextLabel4 = new QLabel (GroupBox1);
+ TextLabel5 = new QLabel (GroupBox1);
+ TextLabel6 = new QLabel (GroupBox1);
+
+ SpinBox_DX1 = new SalomeApp_DoubleSpinBox (GroupBox1);
+ SpinBox_DY1 = new SalomeApp_IntSpinBox (GroupBox1);
+ SpinBox_DX2 = new SalomeApp_DoubleSpinBox (GroupBox1);
+ SpinBox_DY2 = new SalomeApp_IntSpinBox (GroupBox1);
+
+ //gridLayout1->addWidget(TextLabel3, 2, 0, 1, 1);
+ gridLayout1->addWidget(CheckAngleStep, 2, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel4, 3, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel5, 5, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel6, 6, 0, 1, 1);
+
+ gridLayout1->addWidget(SpinBox_DX1, 2, 1, 1, 2);
+ gridLayout1->addWidget(SpinBox_DY1, 3, 1, 1, 2);
+ gridLayout1->addWidget(SpinBox_DX2, 5, 1, 1, 2);
+ gridLayout1->addWidget(SpinBox_DY2, 6, 1, 1, 2);
+
+ // 1Check
+ CheckButton1 = new QCheckBox (GroupBox1);
+
+ gridLayout1->addWidget(CheckButton1, 4, 0, 1, 3);
+
+ gridLayout->addWidget(GroupBox1, 0, 0, 1, 1);
+}
+
+//=================================================================================
+// function : ~TransformationGUI_2Sel4Spin1Check()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+TransformationGUI_2Sel4Spin1Check::~TransformationGUI_2Sel4Spin1Check()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h
index fac7bd502..ed4268145 100644
--- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h
+++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h
@@ -18,34 +18,78 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : TransformationGUI_MultiRotationDlg.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
#ifndef TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#define TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#include "GEOMBase_Skeleton.h"
#include "GEOM_GenericObjPtr.h"
-class DlgRef_2Sel4Spin1Check;
-class DlgRef_2Sel1SpinInt;
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+//=================================================================================
+// class : TransformationGUI_2Sel4Spin1Check
+// purpose :
+//=================================================================================
+class TransformationGUI_2Sel4Spin1Check : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ TransformationGUI_2Sel4Spin1Check (QWidget *parent);
+ ~TransformationGUI_2Sel4Spin1Check();
+
+ public:
+ QGridLayout *gridLayout;
+ QGroupBox *GroupBox1;
+ QGridLayout *gridLayout1;
+
+ // 2Sel
+ QLabel *TextLabel1;
+ QLabel *TextLabel2;
+ QPushButton *PushButton1;
+ QPushButton *PushButton2;
+ QLineEdit *LineEdit1;
+ QLineEdit *LineEdit2;
+
+ // 4Spin (double-int-double-int)
+ QCheckBox *CheckAngleStep;
+ QLabel *TextLabel4;
+ QLabel *TextLabel5;
+ QLabel *TextLabel6;
+ SalomeApp_DoubleSpinBox *SpinBox_DX1;
+ SalomeApp_IntSpinBox *SpinBox_DY1;
+ SalomeApp_DoubleSpinBox *SpinBox_DX2;
+ SalomeApp_IntSpinBox *SpinBox_DY2;
+
+ // 1Check
+ QCheckBox *CheckButton1;
+};
//=================================================================================
// class : TransformationGUI_MultiRotationDlg
// purpose :
//=================================================================================
class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton
-{
+{
Q_OBJECT
public:
- TransformationGUI_MultiRotationDlg( GeometryGUI*, QWidget* = 0,
- bool = false, Qt::WindowFlags = 0 );
+ TransformationGUI_MultiRotationDlg (GeometryGUI*, QWidget* = 0,
+ bool = false, Qt::WindowFlags = 0);
~TransformationGUI_MultiRotationDlg();
-
+
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
@@ -57,7 +101,7 @@ protected:
private:
void Init();
void enterEvent( QEvent* );
-
+
private:
GEOM::GeomObjPtr myBase, myVector;
int myNbTimes1;
@@ -67,9 +111,8 @@ private:
// to initialize the first selection field with a selected object on the dialog creation
bool myInitial;
-
- DlgRef_2Sel1SpinInt* GroupPoints;
- DlgRef_2Sel4Spin1Check* GroupDimensions;
+
+ TransformationGUI_2Sel4Spin1Check* GroupArgs;
private slots:
void ClickOnOk();
@@ -77,6 +120,7 @@ private slots:
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void CheckAngleStep (bool);
void ReverseAngle();
void ValueChangedInSpinBox( double );
void ValueChangedInSpinBox( int );
diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
index 352f88c2e..60eb1f981 100644
--- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
+++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
@@ -82,10 +82,10 @@ TransformationGUI_MultiTranslationDlg::TransformationGUI_MultiTranslationDlg
GroupPoints = new DlgRef_2Sel2Spin1Check(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE"));
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
- GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U"));
- GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U"));
- GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U"));
- GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_STEP"));
+ GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES"));
+ GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_DIRECTION"));
GroupPoints->PushButton1->setIcon(image2);
GroupPoints->PushButton2->setIcon(image2);
GroupPoints->LineEdit1->setReadOnly(true);
@@ -142,7 +142,7 @@ void TransformationGUI_MultiTranslationDlg::Init()
int SpecificStep = 1;
// init variables
myStepU = myStepV = 50.0;
- myNbTimesU = myNbTimesV = 2;
+ myNbTimesU = myNbTimesV = 3;
// min, max, step and decimals for spin boxes & initial values
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
@@ -328,9 +328,20 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
QString aName = GEOMBase::GetName( aSelectedObject.get() );
myEditCurrentArgument->setText( aName );
+
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
myBase = aSelectedObject;
- if ( !myVectorU )
+
+ // recompute myStepU (Mantis issue 0021718)
+ GEOM::GEOM_IMeasureOperations_var anOper = getGeomEngine()->GetIMeasureOperations(getStudyId());
+ double Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
+ anOper->GetBoundingBox(myBase.get(), Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
+ if (anOper->IsDone()) {
+ myStepU = floor(1.5 * (Xmax - Xmin));
+ GroupPoints->SpinBox_DX->setValue(myStepU);
+ }
+
+ if (!myVectorU)
GroupPoints->PushButton2->click();
}
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
@@ -340,6 +351,18 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
}
else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) {
myBase = aSelectedObject;
+
+ // recompute myStepU and myStepV (Mantis issue 0021718)
+ GEOM::GEOM_IMeasureOperations_var anOper = getGeomEngine()->GetIMeasureOperations(getStudyId());
+ double Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
+ anOper->GetBoundingBox(myBase.get(), Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
+ if (anOper->IsDone()) {
+ myStepU = floor(1.5 * (Xmax - Xmin));
+ myStepV = floor(1.5 * (Ymax - Ymin));
+ GroupDimensions->SpinBox_DX1->setValue(myStepU);
+ GroupDimensions->SpinBox_DX2->setValue(myStepV);
+ }
+
if ( !myVectorU )
GroupDimensions->PushButton2->click();
else if ( !myVectorV )
@@ -597,18 +620,20 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio
bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
{
bool ok = false;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0:
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
- myBase && myVectorU;
+ myBase;
+ //myBase && myVectorU; // Mantis issue 0021718
break;
case 1:
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
- myBase && myVectorU && myVectorV;
+ myBase;
+ //myBase && myVectorU && myVectorV; // Mantis issue 0021718
break;
default:
break;
@@ -625,43 +650,38 @@ bool TransformationGUI_MultiTranslationDlg::execute (ObjectList& objects)
bool res = false;
GEOM::GEOM_Object_var anObj;
-
QStringList aParameters;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
- if ( myBase && myVectorU ) {
- createPathPreview ( myVectorU.get() );
- anObj = anOper->MultiTranslate1D(myBase.get(), myVectorU.get(), myStepU, myNbTimesU);
- if(!IsPreview()) {
- aParameters<SpinBox_DX->text();
- aParameters<SpinBox_DY->text();
- }
- res = true;
+ createPathPreview(myVectorU.get());
+ anObj = anOper->MultiTranslate1D(myBase.get(), myVectorU.get(), myStepU, myNbTimesU);
+ if (!IsPreview()) {
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
}
+ res = true;
break;
case 1:
- if ( myBase && myVectorU && myVectorV ) {
- createPathPreview ( myVectorU.get() );
- createPathPreview ( myVectorV.get() );
- anObj = anOper->MultiTranslate2D(myBase.get(),
- myVectorU.get(), myStepU, myNbTimesU,
- myVectorV.get(), myStepV, myNbTimesV);
- if(!IsPreview()) {
- aParameters<SpinBox_DX1->text();
- aParameters<SpinBox_DY1->text();
- aParameters<SpinBox_DX2->text();
- aParameters<SpinBox_DY2->text();
- }
- res = true;
+ createPathPreview(myVectorU.get());
+ createPathPreview(myVectorV.get());
+ anObj = anOper->MultiTranslate2D(myBase.get(),
+ myVectorU.get(), myStepU, myNbTimesU,
+ myVectorV.get(), myStepV, myNbTimesV);
+ if (!IsPreview()) {
+ aParameters << GroupDimensions->SpinBox_DX1->text();
+ aParameters << GroupDimensions->SpinBox_DY1->text();
+ aParameters << GroupDimensions->SpinBox_DX2->text();
+ aParameters << GroupDimensions->SpinBox_DY2->text();
}
+ res = true;
break;
}
if (!anObj->_is_nil()) {
- if(!IsPreview())
+ if (!IsPreview())
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}
@@ -716,6 +736,7 @@ void TransformationGUI_MultiTranslationDlg::restoreSubShapes (SALOMEDS::Study_pt
void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Object_ptr thePath )
{
if ( IsPreview() ) {
+ if (thePath->_is_nil()) return;
TopoDS_Shape aShape;
GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE );
TopoDS_Edge anEdge = TopoDS::Edge( aShape );