]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
To implement issue 0019962: MakePipeBiNormalAlongAxis implementation.
authorakl <akl@opencascade.com>
Mon, 29 Sep 2008 06:37:21 +0000 (06:37 +0000)
committerakl <akl@opencascade.com>
Mon, 29 Sep 2008 06:37:21 +0000 (06:37 +0000)
18 files changed:
doc/salome/gui/GEOM/images/pipe2.png [new file with mode: 0755]
idl/GEOM_Gen.idl
idl/GEOM_Superv.idl
resources/Makefile.am
resources/pipebinormal.png [new file with mode: 0644]
src/GEOMGUI/GEOM_images.po
src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx
src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx
src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx [new file with mode: 0644]
src/GEOMImpl/GEOMImpl_PipeDriver.cxx
src/GEOMImpl/GEOMImpl_Types.hxx
src/GEOM_I/GEOM_I3DPrimOperations_i.cc
src/GEOM_I/GEOM_I3DPrimOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/geompyDC.py
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.h

diff --git a/doc/salome/gui/GEOM/images/pipe2.png b/doc/salome/gui/GEOM/images/pipe2.png
new file mode 100755 (executable)
index 0000000..0a69cd8
Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipe2.png differ
index 26a9368dc948520a0448805d9289acf11eddb707..c130973fb3d19d11e472298aea967829c1dcc63d 100644 (file)
@@ -1048,6 +1048,21 @@ module GEOM
      */
     GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
                                           in ListOfGO theLocations);
+
+    /*!
+     *  Create a shape by extrusion of the base shape along
+     *  the path shape with constant bi-normal direction along the given vector. 
+     *  The path shape can be a wire or an edge.
+     *  \param theBase Base shape to be extruded.
+     *  \param thePath Path shape to extrude the base shape along it.
+     *  \param theVec Vector defines a constant binormal direction to keep the
+     *                same angle beetween the Direction and the sections
+     *                along the sweep surface.
+     *  \return New GEOM_Object, containing the created pipe.
+     */
+    GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase, 
+                                            in GEOM_Object thePath, 
+                                            in GEOM_Object theVec);
   };
 
   /*!
index d0f2f4034e8de21a9178c1804d94ca6a26d99361..45892a2d41b993fb129e616122454314a5bc92af 100644 (file)
@@ -198,6 +198,10 @@ module GEOM
     GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
                                           in ListOfGO theLocations );
 
+    GEOM_Object MakePipeBiNormalAlongVector (in GEOM_Object theBase, 
+                                            in GEOM_Object thePath, 
+                                            in GEOM_Object theVec);
+
     //-----------------------------------------------------------//
     // BooleanOperations                                         //
     //-----------------------------------------------------------//
index cce9daad6cdd72c94d6d2e4e77f06efdebbe1973..07c53585148729beb0e98780161f55a6e11bd4f1 100644 (file)
@@ -107,6 +107,7 @@ partition.png \
 partitionkeep.png \
 partitionplane.png \
 pipe.png \
+pipebinormal.png \
 plane.png \
 planeWorking.png \
 planedxyz.png \
diff --git a/resources/pipebinormal.png b/resources/pipebinormal.png
new file mode 100644 (file)
index 0000000..1d013d2
Binary files /dev/null and b/resources/pipebinormal.png differ
index 475db68abb5ab67b4e3550e23d9e4e09c9793627..a85756d9e252c6f2a4cc8a116fe22aa31a3ded38 100644 (file)
@@ -359,6 +359,9 @@ msgstr "remove_extra_edges.png"
 msgid "ICON_DLG_PIPE"
 msgstr "pipe.png"
 
+msgid "ICON_DLG_PIPE_BINORMAL"
+msgstr "pipebinormal.png"
+
 #PrismDlg
 msgid "ICON_DLG_PRISM"
 msgstr "prism.png"
index a1c554544528d6aa825ae2b810144f72ca162eb0..6d84b9940d732abd85fb31f50130333d93ac8474 100644 (file)
@@ -60,6 +60,7 @@
 #include <GEOMImpl_IThruSections.hxx>
 #include <GEOMImpl_IPipeDiffSect.hxx>
 #include <GEOMImpl_IPipeShellSect.hxx>
+#include <GEOMImpl_IPipeBiNormal.hxx>
 
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
@@ -1728,3 +1729,64 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
 
 }
 
+
+//=============================================================================
+/*!
+ *  MakePipeBiNormalAlongVector
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
+                                                                            Handle(GEOM_Object) thePath,
+                                                                            Handle(GEOM_Object) theVec)
+{
+  SetErrorCode(KO);
+
+  if (theBase.IsNull() || thePath.IsNull() || theVec.IsNull()) return NULL;
+
+  //Add a new Pipe object
+  Handle(GEOM_Object) aPipe = GetEngine()->AddObject(GetDocID(), GEOM_PIPE);
+
+  //Add a new Pipe function
+  Handle(GEOM_Function) aFunction =
+    aPipe->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_BI_NORMAL_ALONG_VECTOR);
+  if (aFunction.IsNull()) return NULL;
+
+  //Check if the function is set correctly
+  if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return NULL;
+
+  GEOMImpl_IPipeBiNormal aCI (aFunction);
+
+  Handle(GEOM_Function) aRefBase = theBase->GetLastFunction();
+  Handle(GEOM_Function) aRefPath = thePath->GetLastFunction();
+  Handle(GEOM_Function) aRefVec  = theVec->GetLastFunction();
+
+  if (aRefBase.IsNull() || aRefPath.IsNull() || aRefVec.IsNull()) return NULL;
+
+  aCI.SetBase(aRefBase);
+  aCI.SetPath(aRefPath);
+  aCI.SetVector(aRefVec);
+
+  //Compute the Pipe value
+  try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+    OCC_CATCH_SIGNALS;
+#endif
+    if (!GetSolver()->ComputeFunction(aFunction)) {
+      SetErrorCode("Pipe 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) << aPipe << " = geompy.MakePipeBiNormalAlongVector("
+    << theBase << ", " << thePath << ", " << theVec << ")";
+
+  SetErrorCode(OK);
+  return aPipe;
+}
+
index 5f1f52f36411681bc3dcef256689134ea7fa8dfe..c09edc45cced2240f6f36dfad3981cbe2880f278 100644 (file)
@@ -109,6 +109,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
                const Handle(TColStd_HSequenceOfTransient)& theBases,
                const Handle(TColStd_HSequenceOfTransient)& theLocations);
 
+  Standard_EXPORT Handle(GEOM_Object) MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
+                                                                  Handle(GEOM_Object) thePath,
+                                                                  Handle(GEOM_Object) theVec);
+
 };
 
 #endif
diff --git a/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx b/src/GEOMImpl/GEOMImpl_IPipeBiNormal.hxx
new file mode 100644 (file)
index 0000000..38d62fa
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//NOTE: This is an interface to a function for the Pipe creation.
+
+#ifndef _GEOMImpl_IPIPEBINORMAL_HXX_
+#define _GEOMImpl_IPIPEBINORMAL_HXX_
+
+#include "GEOM_Function.hxx"
+
+#ifndef _GEOMImpl_IPIPE_HXX_
+#include "GEOMImpl_IPipe.hxx"
+#endif
+
+#define PIPE_ARG_BASE 1
+#define PIPE_ARG_PATH 2
+#define PIPE_ARG_VEC  3
+
+class GEOMImpl_IPipeBiNormal : public GEOMImpl_IPipe
+{
+ public:
+
+  GEOMImpl_IPipeBiNormal(Handle(GEOM_Function)& theFunction):GEOMImpl_IPipe(theFunction) {}
+  
+  void SetVector(Handle(GEOM_Function) theVec) { _func->SetReference(PIPE_ARG_VEC, theVec); }
+
+  Handle(GEOM_Function) GetVector() { return _func->GetReference(PIPE_ARG_VEC); }
+
+};
+
+#endif
index 41aec47585d22ed6c750270cb1b0b5250b616a44..036abfdb712e50d5f2a1e02c5f6f4242be7cef3c 100644 (file)
@@ -25,6 +25,7 @@
 #include <GEOMImpl_IShapesOperations.hxx>
 #include <GEOMImpl_IPipeDiffSect.hxx>
 #include <GEOMImpl_IPipeShellSect.hxx>
+#include <GEOMImpl_IPipeBiNormal.hxx>
 #include <GEOMImpl_IPipe.hxx>
 #include <GEOMImpl_Types.hxx>
 #include <GEOM_Function.hxx>
@@ -1851,6 +1852,69 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI)
 }
 
 
+//=======================================================================
+//function : CreatePipeBiNormalAlongVector
+//purpose  : auxilary for Execute()
+//=======================================================================
+static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath,
+                                                 GEOMImpl_IPipe* aCI)
+{
+  GEOMImpl_IPipeBiNormal* aCIBN = (GEOMImpl_IPipeBiNormal*)aCI;
+
+  Handle(GEOM_Function) aRefBase = aCIBN->GetBase();
+  Handle(GEOM_Function) aRefVec = aCIBN->GetVector();
+  TopoDS_Shape aShapeBase = aRefBase->GetValue();
+  TopoDS_Shape aShapeVec = aRefVec->GetValue();
+
+  if (aShapeBase.IsNull()) {
+    if(aCIBN) delete aCIBN;
+    Standard_NullObject::Raise("MakePipe aborted : null base argument");
+  }
+
+  TopoDS_Shape aProf;
+  if( aShapeBase.ShapeType() == TopAbs_EDGE) {
+    aProf = BRepBuilderAPI_MakeWire(TopoDS::Edge(aShapeBase)).Shape();
+  }
+  else if( aShapeBase.ShapeType() == TopAbs_WIRE) {
+    aProf = aShapeBase;
+  }
+  else if( aShapeBase.ShapeType() == TopAbs_FACE) {
+    TopExp_Explorer wexp(aShapeBase,TopAbs_WIRE);
+    aProf = wexp.Current();
+  }
+  else {
+    Standard_TypeMismatch::Raise
+      ("MakePipe aborted : invalid type of base");
+  }
+  BRepOffsetAPI_MakePipeShell PipeBuilder(aWirePath);
+  PipeBuilder.Add(aProf);
+
+  if (aShapeVec.IsNull()) {
+    if(aCIBN) delete aCIBN;
+    Standard_NullObject::Raise
+      ("MakePipe aborted : null vector argument");
+  }
+  if (aShapeVec.ShapeType() != TopAbs_EDGE)
+    Standard_TypeMismatch::Raise
+      ("MakePipe aborted: invalid type of vector");
+  TopoDS_Edge anEdge = TopoDS::Edge(aShapeVec);
+  TopoDS_Vertex V1, V2;
+  TopExp::Vertices(anEdge, V1, V2, Standard_True);
+  if (V1.IsNull() || V2.IsNull())
+    Standard_NullObject::Raise
+      ("MakePipe aborted: vector is not defined");
+  gp_Vec aVec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
+  gp_Dir BiNormal(aVec);
+  PipeBuilder.SetMode(BiNormal);
+  PipeBuilder.Build();
+  if( aShapeBase.ShapeType() == TopAbs_FACE) {
+      PipeBuilder.MakeSolid();
+  }
+
+  return PipeBuilder.Shape();
+}
+
+
 //=======================================================================
 //function : Execute
 //purpose  :
@@ -1870,6 +1934,8 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
     aCI = new GEOMImpl_IPipeShellSect(aFunction);
   else if(aType == PIPE_SHELLS_WITHOUT_PATH)
     aCI = new GEOMImpl_IPipeShellSect(aFunction);
+  else if(aType == PIPE_BI_NORMAL_ALONG_VECTOR)
+    aCI = new GEOMImpl_IPipeBiNormal(aFunction);
   else
     return 0;
 
@@ -2293,6 +2359,11 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const
     aShape = CreatePipeShellsWithoutPath(aCI);
   }
 
+  //building a pipe with constant bi-normal along given vector
+  else if (aType == PIPE_BI_NORMAL_ALONG_VECTOR) {
+    aShape = CreatePipeBiNormalAlongVector(aWirePath, aCI);
+  }
+
   if (aCI) {
     delete aCI;
     aCI = 0;
index 54b1564480c11c632cc49b850cb68d810019f157..cb7987537b569510b7c3db98bc7666b0079c6c0c 100755 (executable)
 #define PIPE_DIFFERENT_SECTIONS 2
 #define PIPE_SHELL_SECTIONS 3
 #define PIPE_SHELLS_WITHOUT_PATH 4
+#define PIPE_BI_NORMAL_ALONG_VECTOR 5
 
 #define THRUSECTIONS_RULED 1
 #define THRUSECTIONS_SMOOTHED 2
index 55160f0fb836aaf88279c1fc7422fee5263b77f0..743cffdf1b3315d818df47e20eda7824e683cc95 100644 (file)
@@ -819,3 +819,41 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
 
   return GetObject(anObject);
 }
+
+
+//=============================================================================
+/*!
+ *  MakePipeBiNormalAlongVector
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
+                 (GEOM::GEOM_Object_ptr theBase, 
+                 GEOM::GEOM_Object_ptr thePath, 
+                 GEOM::GEOM_Object_ptr theVec)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  if (theBase == NULL || thePath == NULL || theVec == NULL) return aGEOMObject._retn();
+
+  //Get the reference objects
+  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
+    (theBase->GetStudyID(), theBase->GetEntry());
+  Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
+    (thePath->GetStudyID(), thePath->GetEntry());
+  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
+    (theVec->GetStudyID(), theVec->GetEntry());
+
+  if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
+
+  //Create the Pipe
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
index 330f4974b59b5300cb2d17321c46ed2b5da296be..d2bd5b321714cb336e305336d90b47ab7adac887 100644 (file)
@@ -128,6 +128,10 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
   GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
                                                  const GEOM::ListOfGO& theLocations);
 
+  GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase,
+                                                    GEOM::GEOM_Object_ptr thePath,
+                                                    GEOM::GEOM_Object_ptr theVec);
+
   ::GEOMImpl_I3DPrimOperations* GetOperations()
   { return (::GEOMImpl_I3DPrimOperations*)GetImpl(); }
 };
index 461ef2d96f38af20245e4ead23c67c4574d0998d..0f89227f164da71520b68a17f193c715e1a2b610 100644 (file)
@@ -1120,6 +1120,23 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeShellsWithoutPath
 }
 
 
+//=============================================================================
+//  MakePipe:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeBiNormalAlongVector 
+                                                (GEOM::GEOM_Object_ptr theBase, 
+                                                GEOM::GEOM_Object_ptr thePath, 
+                                                GEOM::GEOM_Object_ptr theVec)
+{
+  beginService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" );
+  MESSAGE("GEOM_Superv_i::MakePipeBiNormalAlongVector");
+  get3DPrimOp();
+  GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipeBiNormalAlongVector(theBase, thePath, theVec);
+  endService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" );
+  return anObj;
+}
+
+
 //=============================================================================
 //  MakeFuse:
 //=============================================================================
index bdeadb12db2eb269368e20306e8e208dec30b2af..58a0ba0a6ccca8af1b2ec8bac0374c54c3679483 100644 (file)
@@ -260,6 +260,10 @@ public:
   GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
                                                  const GEOM::ListOfGO& theLocations);
   
+  GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase,
+                                                    GEOM::GEOM_Object_ptr thePath,
+                                                    GEOM::GEOM_Object_ptr theVec);
+
   //-----------------------------------------------------------//
   // BooleanOperations                                         //
   //-----------------------------------------------------------//
index 65fde5c8aaa8df39e93fda12ae1e3545a3ec4bf1..f0afc1d9c8835c330835be6e66644d5f44a1d4b7 100644 (file)
@@ -1027,6 +1027,23 @@ class geompyDC(GEOM._objref_GEOM_Gen):
             RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
             return anObj
 
+        ## Create a shape by extrusion of the base shape along
+        #  the path shape with constant bi-normal direction along the given vector.
+        #  The path shape can be a wire or an edge.
+        #  @param theBase Base shape to be extruded.
+        #  @param thePath Path shape to extrude the base shape along it.
+        #  @param theVec Vector defines a constant binormal direction to keep the
+        #                same angle beetween the direction and the sections
+        #                along the sweep surface.
+        #  @return New GEOM_Object, containing the created pipe.
+        #
+        #  @ref tui_creation_pipe "Example"
+        def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
+            # Example: see GEOM_TestAll.py
+            anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
+            RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
+            return anObj
+
         # end of l3_complex
         ## @}
 
index 2d124940d10ce112347e44ac54c6d732016c19a1..e660e6819f76c7c4a743c14857e842e60c5af374 100644 (file)
@@ -67,23 +67,24 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg(GeometryGUI* theGeometryGUI, QWidge
 {
   QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE")));
   QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
+  QPixmap image2(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_PIPE_BINORMAL")));
 
   setCaption(tr("GEOM_PIPE_TITLE"));
 
   /***************************************************************/
   GroupConstructors->setTitle(tr("GEOM_PIPE"));
   RadioButton1->setPixmap(image0);
-  RadioButton2->close(TRUE);
+  RadioButton2->setPixmap(image2);
   RadioButton3->close(TRUE);
 
-  GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints");
+  GroupPoints = new DlgRef_3Sel_QTD(this, "GroupPoints");
   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
   GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
   GroupPoints->TextLabel2->setText(tr("GEOM_PATH_OBJECT"));
+  GroupPoints->TextLabel3->setText(tr("GEOM_VECTOR"));
   GroupPoints->PushButton1->setPixmap(image1);
   GroupPoints->PushButton2->setPixmap(image1);
-  GroupPoints->LineEdit1->setReadOnly( true );
-  GroupPoints->LineEdit2->setReadOnly( true );
+  GroupPoints->PushButton3->setPixmap(image1);
 
   Layout1->addWidget(GroupPoints, 2, 0);
   /***************************************************************/
@@ -116,17 +117,20 @@ void GenerationGUI_PipeDlg::Init()
   GroupPoints->LineEdit1->setReadOnly( true );
   GroupPoints->LineEdit2->setReadOnly( true );
 
-  myOkBase = myOkPath = false;
+  myOkBase = myOkPath = myOkVec = false;
 
   /* signals and slots connections */
   connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+  connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int)));
 
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+  connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
   connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+  connect(GroupPoints->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   
   connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
@@ -134,6 +138,41 @@ void GenerationGUI_PipeDlg::Init()
   initName(tr("GEOM_PIPE"));
 
   //  globalSelection( GEOM_ALLSHAPES );
+
+  GroupPoints->TextLabel3->hide();
+  GroupPoints->PushButton3->hide();
+  GroupPoints->LineEdit3->hide();
+  ConstructorsClicked( 0 );
+}
+
+
+//=================================================================================
+// function : ConstructorsClicked()
+// purpose  : Radio button management
+//=================================================================================
+void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
+{
+  erasePreview();
+
+  switch (constructorId)
+  {
+    case 0:
+    {
+      GroupPoints->TextLabel3->hide();
+      GroupPoints->PushButton3->hide();
+      GroupPoints->LineEdit3->hide();
+      break;
+    }
+    case 1:
+    {
+      GroupPoints->TextLabel3->show();
+      GroupPoints->PushButton3->show();
+      GroupPoints->LineEdit3->show();
+      break;
+    }
+  }
+
+  displayPreview();
 }
 
 
@@ -158,6 +197,8 @@ bool GenerationGUI_PipeDlg::ClickOnApply()
     return false;
 
   initName();
+  if ( getConstructorId() != 1 )
+       ConstructorsClicked( getConstructorId() );
   return true;
 }
 
@@ -176,6 +217,8 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
       myOkBase = false;
     else if(myEditCurrentArgument == GroupPoints->LineEdit2)
       myOkPath = false;
+    else if(myEditCurrentArgument == GroupPoints->LineEdit3)
+      myOkVec = false;
     return;
   }
   
@@ -197,14 +240,20 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
        S.ShapeType() == TopAbs_SOLID || 
        S.ShapeType() == TopAbs_SHAPE) 
       return;
-    
+    if ( getConstructorId() == 1 && 
+        (S.ShapeType() == TopAbs_SHELL || 
+         S.ShapeType() == TopAbs_VERTEX))
+      return;
+
     myBase = aSelectedObject;
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
     myOkBase = true;
   }
-  else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
-    myOkPath = false;
-    
+  else if(myEditCurrentArgument == GroupPoints->LineEdit2 || 
+         myEditCurrentArgument == GroupPoints->LineEdit3) {
+    myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false;
+    bool myOk = false;
+
     if( !GEOMBase::GetShape(aSelectedObject, S) ) 
       return;
 
@@ -227,22 +276,29 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
            if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
              GEOM::GEOM_IShapesOperations_var aShapesOp =
                getGeomEngine()->GetIShapesOperations( getStudyId() );
-             myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-             myOkPath = true;
+             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+             myOk = true;
            }
            else {  // get Object from study
-             myPath = aFindedObject;
-             myOkPath = true;
+               aSelectedObject = aFindedObject;
+               myOk = true;
            }
          }
        else {
-         myOkPath = true;
+         myOk = true;
          if (S.ShapeType() != TopAbs_EDGE) {
            aSelectedObject = GEOM::GEOM_Object::_nil();
            aName = "";
-           myOkPath = false;
+           myOk = false;
          }
+       }
+       if (myEditCurrentArgument == GroupPoints->LineEdit2) {
          myPath = aSelectedObject;
+         myOkPath = myOk;
+       }
+       else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
+         myVec = aSelectedObject;
+         myOkVec = myOk;
        }
       }
     myEditCurrentArgument->setText( aName );
@@ -272,6 +328,12 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
     globalSelection();
     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
   }
+  else if(send == GroupPoints->PushButton3) {
+    GroupPoints->LineEdit3->setFocus();
+    myEditCurrentArgument = GroupPoints->LineEdit3;
+    globalSelection();
+    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+  }
   SelectionIntoArgument();
 }
 
@@ -284,7 +346,8 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed()
 {
   QLineEdit* send = (QLineEdit*)sender();
   if(send == GroupPoints->LineEdit1 ||
-     send == GroupPoints->LineEdit2)
+     send == GroupPoints->LineEdit2 ||
+     send == GroupPoints->LineEdit3)
     {
       myEditCurrentArgument = send;
       GEOMBase_Skeleton::LineEditReturnPressed();
@@ -313,7 +376,7 @@ void GenerationGUI_PipeDlg::ActivateThisDialog()
   globalSelection( GEOM_ALLSHAPES );
   connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
-  displayPreview();
+  ConstructorsClicked(getConstructorId());
 }
 
 
@@ -332,7 +395,12 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PipeDlg::createOperation()
 //=================================================================================
 bool GenerationGUI_PipeDlg::isValid( QString& )
 {
-  return myOkBase && myOkPath;
+  switch ( getConstructorId() ) {
+  case 0 :
+    return myOkBase && myOkPath;
+  case 1 :
+    return myOkBase && myOkPath && myOkVec;
+  }
 }
 
 //=================================================================================
@@ -343,8 +411,17 @@ bool GenerationGUI_PipeDlg::execute( ObjectList& objects )
 {
   GEOM::GEOM_Object_var anObj;
 
-  anObj = GEOM::GEOM_I3DPrimOperations::_narrow(
+  switch ( getConstructorId() ) {
+  case 0 :
+    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( 
     getOperation() )->MakePipe( myBase, myPath );
+    break;
+
+  case 1 :
+    anObj = GEOM::GEOM_I3DPrimOperations::_narrow( 
+    getOperation() )->MakePipeBiNormalAlongVector( myBase, myPath, myVec );
+    break;
+  }
 
   if ( !anObj->_is_nil() )
     objects.push_back( anObj._retn() );
index b926d6de7b99eee822f7d0ccfcc92b2a9dfd6b82..ab623ff5565ec00ca0471377bb9b533f5cd5674e 100644 (file)
@@ -31,7 +31,7 @@
 #include "GenerationGUI.h"
 
 #include "GEOMBase_Skeleton.h"
-#include "DlgRef_2Sel_QTD.h"
+#include "DlgRef_3Sel_QTD.h"
 
 //=================================================================================
 // class    : GenerationGUI_PipeDlg
@@ -59,10 +59,12 @@ private:
 
     GEOM::GEOM_Object_var myBase; /* Base shape */
     GEOM::GEOM_Object_var myPath; /* Shape, defining the path */
+    GEOM::GEOM_Object_var myVec;  /* Vector, defining the constant binormal direction */
     bool myOkBase;
-    bool myOkPath; /* to check when arguments are defined */
+    bool myOkPath;
+    bool myOkVec; /* to check when arguments are defined */
 
-    DlgRef_2Sel_QTD* GroupPoints;
+    DlgRef_3Sel_QTD* GroupPoints;
 
 private slots:
     void ClickOnOk();
@@ -71,6 +73,7 @@ private slots:
     void LineEditReturnPressed();
     void SelectionIntoArgument();
     void SetEditCurrentArgument();
+    void ConstructorsClicked(int constructorId);
 };
 
 #endif // DIALOGBOX_PIPE_H