]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0019827: EDF 736 GEOM : Duplication of a object along an elliptic path
authordmv <dmv@opencascade.com>
Fri, 26 Dec 2008 08:46:48 +0000 (08:46 +0000)
committerdmv <dmv@opencascade.com>
Fri, 26 Dec 2008 08:46:48 +0000 (08:46 +0000)
22 files changed:
doc/salome/gui/GEOM/images/transformation13.png
doc/salome/gui/GEOM/input/modify_location_operation.doc
doc/salome/gui/GEOM/input/tui_transformation_operations.doc
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
src/DlgRef/DlgRef.cxx
src/DlgRef/DlgRef.h
src/DlgRef/DlgRef.pro
src/DlgRef/Makefile.am
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMImpl/GEOMImpl_IPosition.hxx
src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
src/GEOMImpl/GEOMImpl_ITransformOperations.hxx
src/GEOMImpl/GEOMImpl_PositionDriver.cxx
src/GEOM_I/GEOM_ITransformOperations_i.cc
src/GEOM_I/GEOM_ITransformOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/GEOM_TestAll.py
src/GEOM_SWIG/geompyDC.py
src/TransformationGUI/TransformationGUI_PositionDlg.cxx
src/TransformationGUI/TransformationGUI_PositionDlg.h

index 71efd5599fa20c572bcf010e5e38adde478191ab..1ae0170df69de5e3c2f164f9a84d741fd775a05f 100644 (file)
Binary files a/doc/salome/gui/GEOM/images/transformation13.png and b/doc/salome/gui/GEOM/images/transformation13.png differ
index 3bb8a6ede1538e4a6accb4e59973749ab3bd8933..9ce13b3f8cd07e049ed3204017e8dcab8107f1d8 100644 (file)
@@ -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 <b>Select Unpublished edges</b> checkbox allows to select subshape edges on
 the other objects.
-\n <b>Arguments:</b> Name + one or several objects + Translation path.
+\n <b>Reverse Direction</b> checkbox allows to REVERSE the direction of the object movement along its path.
+
+<b>Arguments:</b> Name + one or several objects + Translation path.
 \n <b>Advanced option:</b>
    \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 <b>TUI Command:</b> <em>geompy.MakePosition(theObject, theStartLCS,
 theEndLCS),</em>  where \em theObject is a shape, location of which is
 modified, \em theStartLCS is a location to move the shape from, \em
index 8301afa6f5e6bcd6f2e612a027b2b9f0887737cb..7fd356e7c5980ed864325c1e39ecbd8556139e6b 100644 (file)
@@ -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")
index 397012d34ba727e5d0b40d4a6bbdee1d18876acf..2dc3540db368592ba4baf3e622d050a7b064d0cf 100644 (file)
@@ -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.
index 5b5605b618c4ebc82c75ed463e1781aaeaf4ebd7..94ca2a7d61937c038b74540a391e8f84ef1e4caa 100644 (file)
@@ -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                                          //
index f93df1ac281416f08518c0d33627f2c718b585bb..997486d7a5eca4c37e4347a2073b3a84e2e8bd6b 100644 (file)
@@ -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
 //////////////////////////////////////////
index 4e677a32109f9ac7a6ecb3b1e26a309fc1ad1395..21c1eb73bd620a3a0f8c5b904077af7cfe915d16 100644 (file)
@@ -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
 //////////////////////////////////////////
index f8f8240566942d5c06d5fc69e16e38dbd0a3277a..4ba720ba7a09f79ff8b9785dddaea35d97c97e21 100644 (file)
@@ -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
index 46df04ce78d1dbb13c47d9b370b17d441f447fb7..c48834cc7bbe9e7e73d5f2a5dbc2573fd02d3b2d 100644 (file)
@@ -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
 
index af217b165d878558dabd46935d5d4bb06224a7fd..981368ec506c2374bf1efa389632a4868774ee17 100644 (file)
@@ -1304,6 +1304,10 @@ Please, select face, shell or solid and try again</translation>
             <source>GEOM_REVERSE</source>
             <translation>Reverse</translation>
         </message>
+       <message>
+            <source>GEOM_REVERSE_DIRECTION</source>
+            <translation>Reverse Direction</translation>
+        </message>
         <message>
             <source>GEOM_REVERSE_PLANE</source>
             <translation>Reverse the plane normal</translation>
index b01b1115a11ccd3f6d5a8e858dd1f91fbafa4f10..33e604f0eada9f94ef34b952d0bb1a8159ac4d64 100644 (file)
@@ -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;
index 84a0f4991302ae4c2d62e3324ba792f7263aca43..0721e98571e4491e065a0b94699cc08b153e6470 100644 (file)
@@ -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;
index 44830f68c0bc53fb147935fc295733e20999ede2..aafbde2159a8d19896109a394ab36fc93929a31c 100644 (file)
@@ -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,
index c9ddc209711c1eb74031ba0ea12ba46d7c1f47ff..49e019ff0f87b4e091ceffa629e2bf0f54890737 100644 (file)
@@ -32,6 +32,7 @@
 #include <GCPnts_AbscissaPoint.hxx>
 #include <ShHealOper_EdgeDivide.hxx>
 #include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
 #include <BRepTools_WireExplorer.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
@@ -48,6 +49,8 @@
 #include <BRepGProp.hxx>
 #include <ShapeAnalysis_Edge.hxx>
 #include <GeomAdaptor_Curve.hxx>
+#include <BRepGProp.hxx>
+#include <ShapeFix_Wire.hxx>
 
 #include <Precision.hxx>
 #include <gp_Pnt.hxx>
@@ -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);
+       TopoDS_Edge anEdge;
+       if (!aReversed)
+         anEdge = TopoDS::Edge(Edges.Value(i));
+       else
+         anEdge = TopoDS::Edge(Edges.Value(Edges.Length() - i + 1));
+
        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); 
+       aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast);
 
-       if ( aWireLen > (aSummOfLen + aCurLen) ) {
-         aSummOfLen += aCurLen; // Transform a Base object along this Edge
+       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);
index 9715c0c4d10e2fde5c2eb549700071966506f40b..a66ae79701623ecb63184470c4052292858da738 100644 (file)
@@ -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();
 
index 62dc08c9ae53a7f9e5283cb004d429fae7072327..a366020dc117b4e4a1b695f530d5260ae3a2fb80 100644 (file)
@@ -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,
index 283910acfaa02774648a9d1bb4592c7e33f4ab84..196284c0c893dcf70ad0548f1773400351d6f911 100644 (file)
@@ -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;
 }
index ca3781a0745a4b3d3d3a7f3fed310066fb4bd48b..e803f80712918ebc151d0ef50bce989327e50f03 100644 (file)
@@ -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                                          //
index b852c52f58873e23f1b800f51fed53472e1c91f3..f1b275cedf35ed398e7b553b3382d3df658d862b 100644 (file)
@@ -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)
 
index 341506dd12ca27090339794445a80f49c66eba42..f499d97ffe23ce2f790f9bef7d874b4e170d87ee 100644 (file)
@@ -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
 
index 1515623ec45e29e36dd98a19308a51d98410ee5e..f64340c167b15268f2ab9017cff05d46c17be88d 100644 (file)
@@ -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());
       }
index 9a18399d8e21ee10a1128d99aa0507a3d59717d1..e306c52c5abee785a31abe017acb63f3c54da5f6 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <GEOMBase_Skeleton.h>
 
-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();