diff --git a/doc/salome/gui/GEOM/images/transformation13.png b/doc/salome/gui/GEOM/images/transformation13.png
index 71efd5599..1ae0170df 100644
Binary files a/doc/salome/gui/GEOM/images/transformation13.png and b/doc/salome/gui/GEOM/images/transformation13.png differ
diff --git a/doc/salome/gui/GEOM/input/modify_location_operation.doc b/doc/salome/gui/GEOM/input/modify_location_operation.doc
index 3bb8a6ede..9ce13b3f8 100644
--- a/doc/salome/gui/GEOM/input/modify_location_operation.doc
+++ b/doc/salome/gui/GEOM/input/modify_location_operation.doc
@@ -60,17 +60,19 @@ and the Distance parameter (ranging from 0 to 1) defining how far the object wi
otherwise it will be removed.
\n Select Unpublished edges checkbox allows to select subshape edges on
the other objects.
-\n Arguments: Name + one or several objects + Translation path.
+\n Reverse Direction checkbox allows to REVERSE the direction of the object movement along its path.
+
+Arguments: Name + one or several objects + Translation path.
\n Advanced option:
\ref restore_presentation_parameters_page "Set presentation
parameters and subshapes from arguments".
-
+
\image html transformation13.png
-\image html transformation14.png
-
\image html transformation12.png
+\image html transformation14.png
+
\n TUI Command: geompy.MakePosition(theObject, theStartLCS,
theEndLCS), where \em theObject is a shape, location of which is
modified, \em theStartLCS is a location to move the shape from, \em
diff --git a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc
index 8301afa6f..7fd356e7c 100644
--- a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc
+++ b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc
@@ -123,7 +123,7 @@ cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
# modify the location of the given object
position = geompy.MakePosition(cylinder, cs1, cs2)
-position2 = geompy.PositionAlongPath(position, circle, 0.75, 1)
+position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
# add objects in the study
id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index 397012d34..2dc3540db 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -799,13 +799,15 @@ module GEOM
* \param thePath Wire or Edge along that the object will be translated.
* \param theDistance progress of Path (0 = actual location, 1 = end of path location).
* \param theCopy is a true or false parameter. true is to create a copy, false to move the object.
+ * \param theCopy is a true or false parameter. true is to reverse direction, false is to move normal direction.
* \return New GEOM_Object, containing the displaced shape.
*/
GEOM_Object PositionAlongPath (in GEOM_Object theObject,
in GEOM_Object thePath,
in double theDistance,
- in boolean theCopy);
+ in boolean theCopy,
+ in boolean theReverse);
/*!
* Recompute the shape from its arguments.
diff --git a/idl/GEOM_Superv.idl b/idl/GEOM_Superv.idl
index 5b5605b61..94ca2a7d6 100644
--- a/idl/GEOM_Superv.idl
+++ b/idl/GEOM_Superv.idl
@@ -346,7 +346,8 @@ module GEOM
GEOM_Object PositionAlongPath (in GEOM_Object theObject,
in GEOM_Object thePath,
in double theDistance,
- in boolean theCopy);
+ in boolean theCopy,
+ in boolean theReverse);
//-----------------------------------------------------------//
// ShapesOperations //
diff --git a/src/DlgRef/DlgRef.cxx b/src/DlgRef/DlgRef.cxx
index f93df1ac2..997486d7a 100644
--- a/src/DlgRef/DlgRef.cxx
+++ b/src/DlgRef/DlgRef.cxx
@@ -687,6 +687,20 @@ void DlgRef_4Sel1Spin2Check::ShowRows( int fromRow, int toRow, bool toShow )
}
}
+//////////////////////////////////////////
+// DlgRef_4Sel1Spin3Check
+//////////////////////////////////////////
+
+DlgRef_4Sel1Spin3Check::DlgRef_4Sel1Spin3Check( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+ setupUi( this );
+}
+
+DlgRef_4Sel1Spin3Check::~DlgRef_4Sel1Spin3Check()
+{
+}
+
//////////////////////////////////////////
// DlgRef_6Sel
//////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef.h b/src/DlgRef/DlgRef.h
index 4e677a321..21c1eb73b 100644
--- a/src/DlgRef/DlgRef.h
+++ b/src/DlgRef/DlgRef.h
@@ -746,6 +746,22 @@ public:
void ShowRows( int, int, bool = true );
};
+//////////////////////////////////////////
+// DlgRef_4Sel1Spin2Check
+//////////////////////////////////////////
+
+#include "ui_DlgRef_4Sel1Spin3Check_QTD.h"
+
+class DLGREF_EXPORT DlgRef_4Sel1Spin3Check : public QWidget,
+ public Ui::DlgRef_4Sel1Spin3Check_QTD
+{
+ Q_OBJECT
+
+public:
+ DlgRef_4Sel1Spin3Check( QWidget* = 0, Qt::WindowFlags = 0 );
+ ~DlgRef_4Sel1Spin3Check();
+};
+
//////////////////////////////////////////
// DlgRef_6Sel
//////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef.pro b/src/DlgRef/DlgRef.pro
index f8f824056..4ba720ba7 100644
--- a/src/DlgRef/DlgRef.pro
+++ b/src/DlgRef/DlgRef.pro
@@ -57,6 +57,7 @@ HEADERS += DlgRef_3Spin_QTD.h
HEADERS += DlgRef_3Spin1Check_QTD.h
HEADERS += DlgRef_3Sel3Spin1Check_QTD.h
HEADERS += DlgRef_4Sel1Spin2Check_QTD.h
+HEADERS += DlgRef_4Sel1Spin3Check_QTD.h
HEADERS += DlgRef_SpinBox.h
HEADERS += DlgRef_1Sel1Spin.h
HEADERS += DlgRef_1Sel2Spin.h
diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am
index 46df04ce7..c48834cc7 100644
--- a/src/DlgRef/Makefile.am
+++ b/src/DlgRef/Makefile.am
@@ -82,6 +82,7 @@ UIC_FILES = \
ui_DlgRef_4Sel1List1Check_QTD.h \
ui_DlgRef_4Sel1List_QTD.h \
ui_DlgRef_4Sel1Spin2Check_QTD.h \
+ ui_DlgRef_4Sel1Spin3Check_QTD.h \
ui_DlgRef_6Sel_QTD.h \
ui_DlgRef_Skeleton_QTD.h
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index af217b165..981368ec5 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -1304,6 +1304,10 @@ Please, select face, shell or solid and try again
GEOM_REVERSE
Reverse
+
+ GEOM_REVERSE_DIRECTION
+ Reverse Direction
+
GEOM_REVERSE_PLANE
Reverse the plane normal
diff --git a/src/GEOMImpl/GEOMImpl_IPosition.hxx b/src/GEOMImpl/GEOMImpl_IPosition.hxx
index b01b1115a..33e604f0e 100644
--- a/src/GEOMImpl/GEOMImpl_IPosition.hxx
+++ b/src/GEOMImpl/GEOMImpl_IPosition.hxx
@@ -27,6 +27,7 @@
#define POSITION_ARG_END_LCS 3
#define POSITION_ARG_PATH 5
#define POSITION_ARG_DISTANCE 6
+#define POSITION_ARG_REVERSE 7
class GEOMImpl_IPosition
{
@@ -56,6 +57,9 @@ class GEOMImpl_IPosition
double GetDistance() { return _func->GetReal(POSITION_ARG_DISTANCE); }
+ void SetReverse(bool theReverse) { _func->SetReal(POSITION_ARG_REVERSE, theReverse); }
+ bool GetReverse() { return _func->GetReal(POSITION_ARG_REVERSE); }
+
private:
Handle(GEOM_Function) _func;
diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
index 84a0f4991..0721e9857 100644
--- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
@@ -1341,7 +1341,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
(Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
- double theDistance, bool theCopy)
+ double theDistance, bool theCopy, bool theReverse)
{
SetErrorCode(KO);
@@ -1370,6 +1370,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
aTI.SetShape(anOriginal);
aTI.SetPath(thePath->GetLastFunction());
aTI.SetDistance(theDistance);
+ aTI.SetReverse(theReverse);
//Compute the position
try {
@@ -1390,13 +1391,13 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
//Make a Python command
if (theCopy) {
GEOM::TPythonDump(aFunction) << aCopy << " = geompy.PositionAlongPath("
- << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ")";
+ << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
SetErrorCode(OK);
return aCopy;
}
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionAlongPath("
- << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ")";
+ << theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
SetErrorCode(OK);
return theObject;
diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx
index 44830f68c..aafbde215 100644
--- a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx
@@ -121,7 +121,8 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations
Standard_EXPORT Handle(GEOM_Object) PositionAlongPath (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) thePath,
double theDistance,
- bool theCopy);
+ bool theCopy,
+ bool theReverse);
Standard_EXPORT Handle(GEOM_Object) Rotate (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theAxis,
diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx
index c9ddc2097..49e019ff0 100644
--- a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx
@@ -32,6 +32,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -48,6 +49,8 @@
#include
#include
#include
+#include
+#include
#include
#include
@@ -145,6 +148,7 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
Handle(GEOM_Function) aRefShape = aCI.GetShape();
Handle(GEOM_Function) aPathShape = aCI.GetPath();
double aValue = aCI.GetDistance();
+ bool aReversed = aCI.GetReverse();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
TopoDS_Shape aPath = aPathShape->GetValue();
@@ -152,31 +156,70 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
if (aShapeBase.IsNull() || aPath.IsNull())
return 0;
+ //Get a Center Of Mass Of Base Object
+ GProp_GProps aSystem;
+ gp_Pnt aCenterMass;
+ if (aShapeBase.ShapeType() == TopAbs_VERTEX) {
+ aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase));
+ } else if (aShapeBase.ShapeType() == TopAbs_EDGE || aShapeBase.ShapeType() == TopAbs_WIRE) {
+ BRepGProp::LinearProperties(aShapeBase, aSystem);
+ aCenterMass = aSystem.CentreOfMass();
+ } else if (aShapeBase.ShapeType() == TopAbs_FACE || aShapeBase.ShapeType() == TopAbs_SHELL) {
+ BRepGProp::SurfaceProperties(aShapeBase, aSystem);
+ aCenterMass = aSystem.CentreOfMass();
+ } else {
+ BRepGProp::VolumeProperties(aShapeBase, aSystem);
+ aCenterMass = aSystem.CentreOfMass();
+ }
+
TopoDS_Shape aTrimmedPath;
gp_Trsf aTrsf;
Handle(Geom_Curve) aCurve;
Standard_Real aFirst =0.,aLast=0.;
Standard_Real aParam = 0.;
Standard_Real aLength = 0.;
+
+ gp_Pnt aPFirst, aPLast;
- if ( aPath.ShapeType() == TopAbs_EDGE ) {
+ if ( aPath.ShapeType() == TopAbs_EDGE ) { // The Path is Edge
TopoDS_Edge anEdge = TopoDS::Edge(aPath);
- // Computation by Parameter
+
BRep_Tool::Range(anEdge,aFirst,aLast);
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
- aParam = aFirst + aValue*(aLast - aFirst);
- } else if ( aPath.ShapeType() == TopAbs_WIRE ) {
+ if (aReversed)
+ aCurve = aCurve->Reversed();
+
+ aCurve->D0(aFirst, aPFirst);
+ aCurve->D0(aLast, aPLast);
+
+ // Translate a CenterMass of Base Shape to the start of the path
+ if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
+ gp_Trsf aCurTrsf;
+ aCurTrsf.SetTranslation(aCenterMass, aPFirst);
+ aTrsf.PreMultiply(aCurTrsf);
+ }
+ aParam = aFirst + aValue*(aLast - aFirst); // Calculate parameter
+ } else if ( aPath.ShapeType() == TopAbs_WIRE ) { // The path Shape is Wire
+ TopoDS_Wire aWire = TopoDS::Wire(aPath);
+
+ // fix edges order
+ Handle(ShapeFix_Wire) aFixWire = new ShapeFix_Wire;
+ aFixWire->Load(aWire);
+ aFixWire->FixReorder();
+ aWire = aFixWire->Wire();
+
TopExp_Explorer ex;
TopTools_SequenceOfShape Edges;
Standard_Real nbEdges = 0.;
- BRepTools_WireExplorer aWE (TopoDS::Wire(aPath));
- for (; aWE.More(); aWE.Next(), nbEdges++)
+ BRepTools_WireExplorer aWE (aWire);
+ for (; aWE.More(); aWE.Next(), nbEdges++) // Explore a Wire on Edges
Edges.Append(aWE.Current());
Standard_Real aSummOfLen =0.;
Standard_Real aCurLen =0.;
GeomAdaptor_Curve aAdC;
- for(int i=1; i<=Edges.Length(); i++) {
+
+ for(int i=1; i<=Edges.Length(); i++) { // Calculate summary Lenght of edges
TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i));
BRep_Tool::Range(anEdge,aFirst,aLast);
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
@@ -185,29 +228,61 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
aSummOfLen += aCurLen;
}
+ // Move BaseShape to the Start Of the Curve
+ TopoDS_Edge anEdge;
+ if (!aReversed)
+ anEdge = TopoDS::Edge(Edges.Value(1));
+ else
+ anEdge = TopoDS::Edge(Edges.Value(Edges.Length()));
+
+ BRep_Tool::Range(anEdge,aFirst,aLast);
+ aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
+ aCurve->D0(aFirst, aPFirst);
+ aCurve->D0(aLast, aPLast);
+ if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
+ gp_Trsf aCurTrsf;
+ if (aReversed && anEdge.Orientation() == TopAbs_FORWARD)
+ aPFirst = aPLast;
+
+ aCurTrsf.SetTranslation(aCenterMass, aPFirst);
+ aTrsf.PreMultiply(aCurTrsf);
+ }
+
Standard_Real aWireLen = aSummOfLen*aValue;
aSummOfLen = 0;
for(int i=1; i<=Edges.Length(); i++) {
- TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i));
- BRep_Tool::Range(anEdge,aFirst,aLast);
- aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
- aAdC.Load(aCurve,aFirst,aLast);
- aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast);
+ TopoDS_Edge anEdge;
+ if (!aReversed)
+ anEdge = TopoDS::Edge(Edges.Value(i));
+ else
+ anEdge = TopoDS::Edge(Edges.Value(Edges.Length() - i + 1));
- if ( aWireLen > (aSummOfLen + aCurLen) ) {
- aSummOfLen += aCurLen; // Transform a Base object along this Edge
+ aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
+ BRep_Tool::Range(anEdge,aFirst,aLast);
+
+ if (!aReversed && anEdge.Orientation() == TopAbs_REVERSED)
+ aCurve = aCurve->Reversed();
+
+ if (aReversed && anEdge.Orientation() == TopAbs_FORWARD)
+ aCurve = aCurve->Reversed();
+
+ aAdC.Load(aCurve,aFirst,aLast);
+ aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast);
+
+ if ( aWireLen > (aSummOfLen + aCurLen) ) { // Transform a Base object along this Edge
+ aSummOfLen += aCurLen;
gp_Pnt aP1, aP2;
gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2;
aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 );
aCurve->D2(aLast, aP2, aDestVec1, aDestVec2 );
gp_Trsf aCurTrsf;
- if (aStartVec2.Magnitude() < gp::Resolution() || aDestVec2.Magnitude() < gp::Resolution()) // one of the second derivatives is null
- aCurTrsf.SetTranslation(aP1, aP2);
- else {
+ if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) {
gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2);
gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2);
aCurTrsf.SetDisplacement(aStartAx3, aDestAx3);
- }
+ } else
+ aCurTrsf.SetTranslation(aP1, aP2);
+
aTrsf.PreMultiply(aCurTrsf);
}
else {
@@ -221,21 +296,26 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
} else
return 0; // Unknown Type
+ gp_Trsf aCurTrsf;
gp_Pnt aP1, aP2;
gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2;
aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 );
aCurve->D2(aParam, aP2, aDestVec1, aDestVec2 );
- gp_Trsf aCurTrsf;
- if (aStartVec2.Magnitude() < gp::Resolution() || aDestVec2.Magnitude() < gp::Resolution()) // one of the second derivatives is null
- aCurTrsf.SetTranslation(aP1, aP2);
- else {
+ if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) {
gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2);
gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2);
aCurTrsf.SetDisplacement(aStartAx3, aDestAx3);
- }
-
+ } else
+ aCurTrsf.SetTranslation(aP1, aP2);
+
aTrsf.PreMultiply(aCurTrsf);
+
+ if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
+ gp_Trsf aCurTrsf;
+ aCurTrsf.SetTranslation(aPFirst, aCenterMass);
+ aTrsf.PreMultiply(aCurTrsf);
+ }
// Perform transformation
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.cc b/src/GEOM_I/GEOM_ITransformOperations_i.cc
index 9715c0c4d..a66ae7970 100644
--- a/src/GEOM_I/GEOM_ITransformOperations_i.cc
+++ b/src/GEOM_I/GEOM_ITransformOperations_i.cc
@@ -997,7 +997,8 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
(GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
- CORBA::Boolean theCopy)
+ CORBA::Boolean theCopy,
+ CORBA::Boolean theReverse)
{
GEOM::GEOM_Object_var aGEOMObject;
@@ -1021,7 +1022,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
//Perform the position
Handle(GEOM_Object) anObject =
- GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy);
+ GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy, theReverse);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.hh b/src/GEOM_I/GEOM_ITransformOperations_i.hh
index 62dc08c9a..a366020dc 100644
--- a/src/GEOM_I/GEOM_ITransformOperations_i.hh
+++ b/src/GEOM_I/GEOM_ITransformOperations_i.hh
@@ -144,7 +144,8 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
- CORBA::Boolean theCopy);
+ CORBA::Boolean theCopy,
+ CORBA::Boolean theReverse);
GEOM::GEOM_Object_ptr RotateThreePoints (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theCentPoint,
diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc
index 283910acf..196284c0c 100644
--- a/src/GEOM_I_Superv/GEOM_Superv_i.cc
+++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc
@@ -1826,12 +1826,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShapeCopy (GEOM::GEOM_Object_ptr th
GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
- CORBA::Boolean theCopy)
+ CORBA::Boolean theCopy,
+ CORBA::Boolean theReverse)
{
beginService( " GEOM_Superv_i::PositionAlongPath" );
MESSAGE("GEOM_Superv_i::PositionAlongPath");
getTransfOp();
- GEOM::GEOM_Object_ptr anObj = myTransfOp->PositionAlongPath(theObject, thePath, theDistance, theCopy);
+ GEOM::GEOM_Object_ptr anObj = myTransfOp->PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse);
endService( " GEOM_Superv_i::PositionAlongPath" );
return anObj;
}
diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh
index ca3781a07..e803f8071 100644
--- a/src/GEOM_I_Superv/GEOM_Superv_i.hh
+++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh
@@ -422,7 +422,8 @@ public:
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
- CORBA::Boolean theCopy);
+ CORBA::Boolean theCopy,
+ CORBA::Boolean theReverse);
//-----------------------------------------------------------//
// ShapesOperations //
diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py
index b852c52f5..f1b275ced 100644
--- a/src/GEOM_SWIG/GEOM_TestAll.py
+++ b/src/GEOM_SWIG/GEOM_TestAll.py
@@ -207,7 +207,7 @@ def TestAll (geompy, math):
MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) #
MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) #
Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1) #(2 GEOM_Object_ptr, 1 Double, 1 Bool)->GEOM_Object_ptr
+ Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object_ptr, 1 Double, 2 Bool)->GEOM_Object_ptr
Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
Orientation = geompy.ChangeOrientation(Box)
diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py
index 341506dd1..f499d97ff 100644
--- a/src/GEOM_SWIG/geompyDC.py
+++ b/src/GEOM_SWIG/geompyDC.py
@@ -2247,12 +2247,14 @@ class geompyDC(GEOM._objref_GEOM_Gen):
# @param theObject The object to be displaced.
# @param thePath Wire or Edge along that the object will be translated.
# @param theDistance progress of Path (0 = start location, 1 = end of path location).
+ # @param theCopy is to create a copy objects if true.
+ # @param theReverse - 0 for usual direction, 1 to reverse path direction.
# @return New GEOM_Object, containing the displaced shape.
#
# @ref tui_modify_location "Example"
- def PositionAlongPath(self,theObject, thePath, theDistance, theCopy):
+ def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
# Example: see GEOM_TestAll.py
- anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy)
+ anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
RaiseIfFailed("PositionAlongPath", self.TrsfOp)
return anObj
diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx
index 1515623ec..f64340c16 100644
--- a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx
+++ b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx
@@ -66,7 +66,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
mainFrame()->RadioButton2->setIcon(image1);
mainFrame()->RadioButton3->setIcon(image2);
- Group1 = new DlgRef_4Sel1Spin2Check(centralWidget());
+ Group1 = new DlgRef_4Sel1Spin3Check(centralWidget());
Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
Group1->TextLabel1->setText(tr("GEOM_OBJECTS"));
Group1->TextLabel2->setText(tr("GEOM_START_LCS"));
@@ -79,6 +79,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
Group1->PushButton5->setIcon(imageselect);
Group1->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
Group1->CheckButton2->setText(tr("SELECT_UNPUBLISHED_EDGES"));
+ Group1->CheckButton3->setText(tr("GEOM_REVERSE_DIRECTION"));
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
@@ -122,7 +123,7 @@ void TransformationGUI_PositionDlg::Init()
Group1->LineEdit5->setText("");
initSpinBox(Group1->SpinBox_DX, 0, 1, 0.05, 6); // VSR:TODO : DBL_DIGITS_DISPLAY
- Group1->SpinBox_DX->setValue(1);
+ Group1->SpinBox_DX->setValue(0);
Group1->CheckButton2->setEnabled(false);
@@ -150,6 +151,7 @@ void TransformationGUI_PositionDlg::Init()
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(Group1->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
+ connect(Group1->CheckButton3, SIGNAL(toggled(bool)), this, SLOT(ValueChangedInSpinBox()));
initName(tr("GEOM_POSITION"));
@@ -192,6 +194,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
Group1->PushButton1->click();
Group1->CheckButton2->hide();
+ Group1->CheckButton3->hide();
}
break;
case 1:
@@ -210,6 +213,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
Group1->PushButton1->click();
Group1->CheckButton2->hide();
+ Group1->CheckButton3->hide();
}
break;
case 2:
@@ -232,6 +236,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
Group1->PushButton1->click();
Group1->CheckButton2->show();
+ Group1->CheckButton3->show();
}
break;
}
@@ -333,6 +338,9 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
return;
else
myEditCurrentArgument->setText(aName);
+
+ if (getConstructorId() == 2)
+ Group1->PushButton5->click();
}
else if (myEditCurrentArgument == Group1->LineEdit2) {
if (aSelList.Extent() != 1)
@@ -363,10 +371,8 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
aName = GEOMBase::GetName(myEndLCS);
myEditCurrentArgument->setText(aName);
- if (!myEndLCS->_is_nil() && !myObjects.length() && getConstructorId() != 2)
+ if (!myEndLCS->_is_nil() && !myObjects.length())
Group1->PushButton1->click();
- else if (getConstructorId() == 2 && !myObjects.length())
- Group1->PushButton5->click();
}
else if (myEditCurrentArgument == Group1->LineEdit5) {
myPath = GEOM::GEOM_Object::_nil();
@@ -413,6 +419,9 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
myEditCurrentArgument->setText(aName);
myPath = aSelectedObject;
+
+ if (!myPath->_is_nil() && !myObjects.length())
+ Group1->PushButton1->click();
}
// clear selection
@@ -631,9 +640,10 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
case 2:
{
double aDistance = Group1->SpinBox_DX->value();
+ bool toReverse = Group1->CheckButton3->isChecked();
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
- PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy);
+ PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy, toReverse);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.h b/src/TransformationGUI/TransformationGUI_PositionDlg.h
index 9a18399d8..e306c52c5 100644
--- a/src/TransformationGUI/TransformationGUI_PositionDlg.h
+++ b/src/TransformationGUI/TransformationGUI_PositionDlg.h
@@ -28,7 +28,7 @@
#include
-class DlgRef_4Sel1Spin2Check;
+class DlgRef_4Sel1Spin3Check;
//=================================================================================
// class : TransformationGUI_PositionDlg
@@ -64,7 +64,7 @@ private:
// to initialize the first selection field with a selected object on the dialog creation
bool myInitial;
- DlgRef_4Sel1Spin2Check* Group1;
+ DlgRef_4Sel1Spin3Check* Group1;
private slots:
void ClickOnOk();