Salome HOME
0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape
authornge <nge>
Thu, 15 Apr 2010 17:41:44 +0000 (17:41 +0000)
committernge <nge>
Thu, 15 Apr 2010 17:41:44 +0000 (17:41 +0000)
54 files changed:
doc/salome/tui/doxyfile.in
idl/GEOM_Gen.idl
resources/Makefile.am
resources/dlg_pipetshape.png [new file with mode: 0644]
resources/dlg_pipetshapechamfer.png [new file with mode: 0644]
resources/dlg_pipetshapechamferh.png [new file with mode: 0644]
resources/dlg_pipetshapechamferl1.png [new file with mode: 0644]
resources/dlg_pipetshapechamferl2.png [new file with mode: 0644]
resources/dlg_pipetshapechamferr1.png [new file with mode: 0644]
resources/dlg_pipetshapechamferr2.png [new file with mode: 0644]
resources/dlg_pipetshapechamferw.png [new file with mode: 0644]
resources/dlg_pipetshapechamferw1.png [new file with mode: 0644]
resources/dlg_pipetshapechamferw2.png [new file with mode: 0644]
resources/dlg_pipetshapefillet.png [new file with mode: 0644]
resources/dlg_pipetshapefilletl1.png [new file with mode: 0644]
resources/dlg_pipetshapefilletl2.png [new file with mode: 0644]
resources/dlg_pipetshapefilletr1.png [new file with mode: 0644]
resources/dlg_pipetshapefilletr2.png [new file with mode: 0644]
resources/dlg_pipetshapefilletrf.png [new file with mode: 0644]
resources/dlg_pipetshapefilletw1.png [new file with mode: 0644]
resources/dlg_pipetshapefilletw2.png [new file with mode: 0644]
resources/dlg_pipetshapel1.png [new file with mode: 0644]
resources/dlg_pipetshapel2.png [new file with mode: 0644]
resources/dlg_pipetshaper1.png [new file with mode: 0644]
resources/dlg_pipetshaper2.png [new file with mode: 0644]
resources/dlg_pipetshapew1.png [new file with mode: 0644]
resources/dlg_pipetshapew2.png [new file with mode: 0644]
resources/pipetshape.png [new file with mode: 0644]
resources/pipetshape_import_icon.png [new file with mode: 0644]
resources/tree_pipetshape.png [new file with mode: 0644]
src/AdvancedGUI/AdvancedGUI.cxx
src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx [new file with mode: 0644]
src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h [new file with mode: 0644]
src/AdvancedGUI/Makefile.am
src/DlgRef/DlgRef.cxx
src/DlgRef/DlgRef.h
src/DlgRef/DlgRef_PipeTShape_ScrollArea_QTD.ui [new file with mode: 0644]
src/DlgRef/Makefile.am
src/GEOMGUI/GEOM_images.ts
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI_Operations.h
src/GEOMImpl/GEOMImpl_Gen.cxx
src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx
src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx
src/GEOMImpl/GEOMImpl_IPipeTShape.hxx [new file with mode: 0644]
src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx [new file with mode: 0644]
src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx [new file with mode: 0644]
src/GEOMImpl/GEOMImpl_Types.hxx
src/GEOMImpl/GUID.txt
src/GEOMImpl/Makefile.am
src/GEOM_I/GEOM_IAdvancedOperations_i.cc
src/GEOM_I/GEOM_IAdvancedOperations_i.hh
src/GEOM_SWIG/geompyDC.py

index 6534ebc077bc366c1b257fa7fc4fac7e5c20ba08..13603b99a2cefcfb294e8f6945c16177db38f36a 100755 (executable)
@@ -264,4 +264,4 @@ DOT_CLEANUP            = YES
 #---------------------------------------------------------------------------
 # Configuration::additions related to the search engine   
 #---------------------------------------------------------------------------
-SEARCHENGINE           = NO
+SEARCHENGINE           = YES
index e3a2b1e8b4646ca9eb3bfff8fb19d4419e2b260d..02c2e469090ecc4b4f8256b54ecc8c2b6ae9e8ac 100644 (file)
@@ -3152,6 +3152,138 @@ module GEOM
    */
   interface GEOM_IAdvancedOperations : GEOM_IOperations
   {
+    /*!
+     *  Create a T-shape object with specified caracteristics for the main and
+     *  the incident pipes (radius, width, half-length).
+     *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+     *  \param theR1 Internal radius of main pipe
+     *  \param theW1 Width of main pipe
+     *  \param theL1 Half-length of main pipe
+     *  \param theR2 Internal radius of incident pipe (R2 < R1)
+     *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+     *  \param theL2 Half-length of incident pipe
+     *  \param theHexMesh false = no partition, true = with partition
+     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+     */
+    ListOfGO MakePipeTShape (in double theR1, in double theW1, in double theL1, 
+                               in double theR2, in double theW2, in double theL2,
+                               in boolean theHexMesh);
+
+    /*!
+     *  Create a T-shape object with specified caracteristics for the main and
+     *  the incident pipes (radius, width, half-length).
+     *  The extremities of the main pipe are located on junctions points P1 and P2.
+     *  The extremity of the incident pipe is located on junction point P3.
+     *
+     *  \param theR1 Internal radius of main pipe
+     *  \param theW1 Width of main pipe
+     *  \param theL1 Half-length of main pipe
+     *  \param theR2 Internal radius of incident pipe (R2 < R1)
+     *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+     *  \param theL2 Half-length of incident pipe
+     *  \param theHexMesh false = no partition, true = with partition
+     *  \param theP1 1st junction point of main pipe
+     *  \param theP2 2nd junction point of main pipe
+     *  \param theP3 Junction point of incident pipe
+     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+     */
+    ListOfGO MakePipeTShapeWithPosition (in double theR1, in double theW1, in double theL1, 
+                                           in double theR2, in double theW2, in double theL2,
+                                           in boolean theHexMesh,
+                                           in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
+
+    /*!
+     *  Create a T-shape object with specified caracteristics for the main and
+     *  the incident pipes (radius, width, half-length). A chamfer is created
+     *  on the junction of the pipes.
+     *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+     *  
+     *  \param theR1 Internal radius of main pipe
+     *  \param theW1 Width of main pipe
+     *  \param theL1 Half-length of main pipe
+     *  \param theR2 Internal radius of incident pipe (R2 < R1)
+     *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+     *  \param theL2 Half-length of incident pipe
+     *  \param theH Height of the chamfer.
+     *  \param theW Width of the chamfer.
+     *  \param theHexMesh false = no partition, true = with partition
+     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+     */
+    ListOfGO MakePipeTShapeChamfer (in double theR1, in double theW1, in double theL1,
+                                   in double theR2, in double theW2, in double theL2,
+                                   in double theH, in double theW, in boolean theHexMesh);
+
+    /*!
+     *  Create a T-shape object with specified caracteristics for the main and
+     *  the incident pipes (radius, width, half-length). A chamfer is created
+     *  on the junction of the pipes.
+     *  The extremities of the main pipe are located on junctions points P1 and P2.
+     *  The extremity of the incident pipe is located on junction point P3.
+     *
+     *  \param theR1 Internal radius of main pipe
+     *  \param theW1 Width of main pipe
+     *  \param theL1 Half-length of main pipe
+     *  \param theR2 Internal radius of incident pipe (R2 < R1)
+     *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+     *  \param theL2 Half-length of incident pipe
+     *  \param theH Height of the chamfer.
+     *  \param theW Width of the chamfer.
+     *  \param theHexMesh false = no partition, true = with partition
+     *  \param theP1 1st junction point of main pipe
+     *  \param theP2 2nd junction point of main pipe
+     *  \param theP3 Junction point of incident pipe
+     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+     */
+    ListOfGO MakePipeTShapeChamferWithPosition (in double theR1, in double theW1, in double theL1, 
+                                                  in double theR2, in double theW2, in double theL2, 
+                                                  in double theH, in double theW, in boolean theHexMesh,
+                                                  in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
+
+    /*!
+     *  Create a T-shape object with specified caracteristics for the main and
+     *  the incident pipes (radius, width, half-length). A fillet is created
+     *  on the junction of the pipes.
+     *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+     *  
+     *  \param theR1 Internal radius of main pipe
+     *  \param theW1 Width of main pipe
+     *  \param theL1 Half-length of main pipe
+     *  \param theR2 Internal radius of incident pipe (R2 < R1)
+     *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+     *  \param theL2 Half-length of incident pipe
+     *  \param theRF Radius of curvature of fillet.
+     *  \param theHexMesh false = no partition, true = with partition
+     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+     */
+    ListOfGO MakePipeTShapeFillet (in double theR1, in double theW1, in double theL1, 
+                                     in double theR2, in double theW2, in double theL2, 
+                                     in double theRF, in boolean theHexMesh);
+
+    /*!
+     *  Create a T-shape object with specified caracteristics for the main and
+     *  the incident pipes (radius, width, half-length). A fillet is created
+     *  on the junction of the pipes.
+     *  The extremities of the main pipe are located on junctions points P1 and P2.
+     *  The extremity of the incident pipe is located on junction point P3.
+     *
+     *  \param theR1 Internal radius of main pipe
+     *  \param theW1 Width of main pipe
+     *  \param theL1 Half-length of main pipe
+     *  \param theR2 Internal radius of incident pipe (R2 < R1)
+     *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+     *  \param theL2 Half-length of incident pipe
+     *  \param theRF Radius of curvature of fillet.
+     *  \param theHexMesh false = no partition, true = with partition
+     *  \param theP1 1st junction point of main pipe
+     *  \param theP2 2nd junction point of main pipe
+     *  \param theP3 Junction point of incident pipe
+     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+     */
+    ListOfGO MakePipeTShapeFilletWithPosition (in double theR1, in double theW1, in double theL1, 
+                                                 in double theR2, in double theW2, in double theL2, 
+                                                 in double theRF, in boolean theHexMesh,
+                                                 in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
+
     /*@@ insert new functions before this line @@*/
   };
     
index c980b1e265b973060816d11dfecf0947f34d0895..ec3661a5006e3d22fce75e3e1fd4644a8c9dc76b 100644 (file)
@@ -229,6 +229,16 @@ coordsys.png                       \
 translation.png
 
 ADVANCED_RESOURCES  =
+ADVANCED_RESOURCES += pipetshape.png tree_pipetshape.png pipetshape_import_icon.png
+ADVANCED_RESOURCES += dlg_pipetshape.png dlg_pipetshapechamfer.png dlg_pipetshapefillet.png
+ADVANCED_RESOURCES += dlg_pipetshapel1.png dlg_pipetshaper1.png dlg_pipetshapew1.png
+ADVANCED_RESOURCES += dlg_pipetshapel2.png dlg_pipetshaper2.png dlg_pipetshapew2.png
+ADVANCED_RESOURCES += dlg_pipetshapechamferl1.png dlg_pipetshapechamferr1.png dlg_pipetshapechamferw1.png
+ADVANCED_RESOURCES += dlg_pipetshapechamferl2.png dlg_pipetshapechamferr2.png dlg_pipetshapechamferw2.png
+ADVANCED_RESOURCES += dlg_pipetshapechamferh.png dlg_pipetshapechamferw.png
+ADVANCED_RESOURCES += dlg_pipetshapefilletl1.png dlg_pipetshapefilletr1.png dlg_pipetshapefilletw1.png
+ADVANCED_RESOURCES += dlg_pipetshapefilletl2.png dlg_pipetshapefilletr2.png dlg_pipetshapefilletw2.png
+ADVANCED_RESOURCES += dlg_pipetshapefilletrf.png
 ##@@ insert new functions before this line @@##
 
 dist_salomeres_DATA += $(ADVANCED_RESOURCES)
diff --git a/resources/dlg_pipetshape.png b/resources/dlg_pipetshape.png
new file mode 100644 (file)
index 0000000..f84178d
Binary files /dev/null and b/resources/dlg_pipetshape.png differ
diff --git a/resources/dlg_pipetshapechamfer.png b/resources/dlg_pipetshapechamfer.png
new file mode 100644 (file)
index 0000000..a614fd7
Binary files /dev/null and b/resources/dlg_pipetshapechamfer.png differ
diff --git a/resources/dlg_pipetshapechamferh.png b/resources/dlg_pipetshapechamferh.png
new file mode 100644 (file)
index 0000000..d1f7637
Binary files /dev/null and b/resources/dlg_pipetshapechamferh.png differ
diff --git a/resources/dlg_pipetshapechamferl1.png b/resources/dlg_pipetshapechamferl1.png
new file mode 100644 (file)
index 0000000..d7afd17
Binary files /dev/null and b/resources/dlg_pipetshapechamferl1.png differ
diff --git a/resources/dlg_pipetshapechamferl2.png b/resources/dlg_pipetshapechamferl2.png
new file mode 100644 (file)
index 0000000..e152078
Binary files /dev/null and b/resources/dlg_pipetshapechamferl2.png differ
diff --git a/resources/dlg_pipetshapechamferr1.png b/resources/dlg_pipetshapechamferr1.png
new file mode 100644 (file)
index 0000000..880231d
Binary files /dev/null and b/resources/dlg_pipetshapechamferr1.png differ
diff --git a/resources/dlg_pipetshapechamferr2.png b/resources/dlg_pipetshapechamferr2.png
new file mode 100644 (file)
index 0000000..f7310f3
Binary files /dev/null and b/resources/dlg_pipetshapechamferr2.png differ
diff --git a/resources/dlg_pipetshapechamferw.png b/resources/dlg_pipetshapechamferw.png
new file mode 100644 (file)
index 0000000..a4fa4a3
Binary files /dev/null and b/resources/dlg_pipetshapechamferw.png differ
diff --git a/resources/dlg_pipetshapechamferw1.png b/resources/dlg_pipetshapechamferw1.png
new file mode 100644 (file)
index 0000000..c966165
Binary files /dev/null and b/resources/dlg_pipetshapechamferw1.png differ
diff --git a/resources/dlg_pipetshapechamferw2.png b/resources/dlg_pipetshapechamferw2.png
new file mode 100644 (file)
index 0000000..13381df
Binary files /dev/null and b/resources/dlg_pipetshapechamferw2.png differ
diff --git a/resources/dlg_pipetshapefillet.png b/resources/dlg_pipetshapefillet.png
new file mode 100644 (file)
index 0000000..1322e25
Binary files /dev/null and b/resources/dlg_pipetshapefillet.png differ
diff --git a/resources/dlg_pipetshapefilletl1.png b/resources/dlg_pipetshapefilletl1.png
new file mode 100644 (file)
index 0000000..37e3712
Binary files /dev/null and b/resources/dlg_pipetshapefilletl1.png differ
diff --git a/resources/dlg_pipetshapefilletl2.png b/resources/dlg_pipetshapefilletl2.png
new file mode 100644 (file)
index 0000000..4c763a0
Binary files /dev/null and b/resources/dlg_pipetshapefilletl2.png differ
diff --git a/resources/dlg_pipetshapefilletr1.png b/resources/dlg_pipetshapefilletr1.png
new file mode 100644 (file)
index 0000000..d414793
Binary files /dev/null and b/resources/dlg_pipetshapefilletr1.png differ
diff --git a/resources/dlg_pipetshapefilletr2.png b/resources/dlg_pipetshapefilletr2.png
new file mode 100644 (file)
index 0000000..883864a
Binary files /dev/null and b/resources/dlg_pipetshapefilletr2.png differ
diff --git a/resources/dlg_pipetshapefilletrf.png b/resources/dlg_pipetshapefilletrf.png
new file mode 100644 (file)
index 0000000..8de432b
Binary files /dev/null and b/resources/dlg_pipetshapefilletrf.png differ
diff --git a/resources/dlg_pipetshapefilletw1.png b/resources/dlg_pipetshapefilletw1.png
new file mode 100644 (file)
index 0000000..abb67aa
Binary files /dev/null and b/resources/dlg_pipetshapefilletw1.png differ
diff --git a/resources/dlg_pipetshapefilletw2.png b/resources/dlg_pipetshapefilletw2.png
new file mode 100644 (file)
index 0000000..64ad6e7
Binary files /dev/null and b/resources/dlg_pipetshapefilletw2.png differ
diff --git a/resources/dlg_pipetshapel1.png b/resources/dlg_pipetshapel1.png
new file mode 100644 (file)
index 0000000..2895b0b
Binary files /dev/null and b/resources/dlg_pipetshapel1.png differ
diff --git a/resources/dlg_pipetshapel2.png b/resources/dlg_pipetshapel2.png
new file mode 100644 (file)
index 0000000..a66a410
Binary files /dev/null and b/resources/dlg_pipetshapel2.png differ
diff --git a/resources/dlg_pipetshaper1.png b/resources/dlg_pipetshaper1.png
new file mode 100644 (file)
index 0000000..897db93
Binary files /dev/null and b/resources/dlg_pipetshaper1.png differ
diff --git a/resources/dlg_pipetshaper2.png b/resources/dlg_pipetshaper2.png
new file mode 100644 (file)
index 0000000..409f9e7
Binary files /dev/null and b/resources/dlg_pipetshaper2.png differ
diff --git a/resources/dlg_pipetshapew1.png b/resources/dlg_pipetshapew1.png
new file mode 100644 (file)
index 0000000..88fb663
Binary files /dev/null and b/resources/dlg_pipetshapew1.png differ
diff --git a/resources/dlg_pipetshapew2.png b/resources/dlg_pipetshapew2.png
new file mode 100644 (file)
index 0000000..e27598e
Binary files /dev/null and b/resources/dlg_pipetshapew2.png differ
diff --git a/resources/pipetshape.png b/resources/pipetshape.png
new file mode 100644 (file)
index 0000000..7169641
Binary files /dev/null and b/resources/pipetshape.png differ
diff --git a/resources/pipetshape_import_icon.png b/resources/pipetshape_import_icon.png
new file mode 100644 (file)
index 0000000..6bc0874
Binary files /dev/null and b/resources/pipetshape_import_icon.png differ
diff --git a/resources/tree_pipetshape.png b/resources/tree_pipetshape.png
new file mode 100644 (file)
index 0000000..4ce53a7
Binary files /dev/null and b/resources/tree_pipetshape.png differ
index d43aecba06574091f371f0b47536fc383cff11af..73a63a60cea251520f56f55abed3f93ce6798dc8 100644 (file)
@@ -31,6 +31,7 @@
 #include <SUIT_Desktop.h>
 #include <SalomeApp_Application.h>
 
+#include "AdvancedGUI_PipeTShapeDlg.h"
 //@@ insert new functions before this line @@//
 
 #include <QDialog>
@@ -65,6 +66,12 @@ bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
   QDialog* aDlg = NULL;
 
   switch ( theCommandID ) {
+  case GEOMOp::OpPipeTShape:
+    aDlg = new AdvancedGUI_PipeTShapeDlg( getGeometryGUI(), parent );
+    break;
+//   case GEOMOp::OpPipeTShapeGroups:
+//     aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent );
+//     break;
   //@@ insert new functions before this line @@//
   default:
     app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx
new file mode 100644 (file)
index 0000000..0e5e6ae
--- /dev/null
@@ -0,0 +1,975 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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
+
+#include "AdvancedGUI_PipeTShapeDlg.h"
+
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_OverrideCursor.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Tools.h>
+#include <LightApp_SelectionMgr.h>
+
+// OCCT Includes
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <gp_Pnt.hxx>
+#include <BRep_Tool.hxx>
+
+#include <GEOMImpl_Types.hxx>
+
+//=================================================================================
+// Constructor
+//=================================================================================
+AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI, QWidget* parent) :
+       GEOMBase_Skeleton(theGeometryGUI, parent, false) {
+       QPixmap imageOp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE")));
+       QPixmap imageSel(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+       QPixmap imageImp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT")));
+       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
+
+       setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE"));
+
+       /***************************************************************/
+       mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE_TSHAPE"));
+       mainFrame()->RadioButton1->setIcon(imageOp);
+       mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+       mainFrame()->RadioButton2->close();
+       mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+       mainFrame()->RadioButton3->close();
+
+       QGridLayout* myMainLayout = new QGridLayout(centralWidget());
+       myMainLayout->setMargin(0);
+       myMainLayout->setSpacing(6);
+
+       PictureView = new DlgRef_PipeTShape_ScrollArea();
+       PictureView->PipeTShape->setBackgroundRole(QPalette::Base);
+       PictureView->PipeTShape->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
+       PictureView->PipeTShape->setScaledContents(true);
+
+       MainTubeGroupParams = new DlgRef_3Spin();
+       MainTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_MPIPE"));
+       MainTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
+       MainTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
+       MainTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
+
+       IncidentTubeGroupParams = new DlgRef_3Spin();
+       IncidentTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_IPIPE"));
+       IncidentTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
+       IncidentTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
+       IncidentTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
+
+       ChamferGroupParams = new DlgRef_2Spin();
+       ChamferGroupParams->GroupBox1->setCheckable(true);
+       ChamferGroupParams->GroupBox1->setChecked(false);
+       ChamferGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_CHAMFER"));
+       ChamferGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_H"));
+       ChamferGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_W"));
+
+       FilletGroupParams = new DlgRef_1Spin();
+       FilletGroupParams->GroupBox1->setCheckable(true);
+       FilletGroupParams->GroupBox1->setChecked(false);
+       FilletGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_FILLET"));
+       FilletGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
+
+       HexMeshCheckBox = new QCheckBox();
+       HexMeshCheckBox->setText(tr("GEOM_PIPE_TSHAPE_HEX"));
+       HexMeshCheckBox->setChecked(true);
+
+       JunctionPointsSel = new DlgRef_6Sel();
+       JunctionPointsSel->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_POSITION"));
+       JunctionPointsSel->GroupBox1->setCheckable(true);
+       JunctionPointsSel->GroupBox1->setChecked(false);
+       JunctionPointsSel->PushButton1->setIcon(imageSel);
+       JunctionPointsSel->LineEdit1->setReadOnly(true);
+       JunctionPointsSel->LineEdit1->setText("");
+       JunctionPointsSel->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P1"));
+
+       JunctionPointsSel->PushButton2->setIcon(imageSel);
+       JunctionPointsSel->LineEdit2->setReadOnly(true);
+       JunctionPointsSel->LineEdit2->setText("");
+       JunctionPointsSel->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P2"));
+
+       JunctionPointsSel->PushButton3->setIcon(imageSel);
+       JunctionPointsSel->LineEdit3->setReadOnly(true);
+       JunctionPointsSel->LineEdit3->setText("");
+       JunctionPointsSel->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P3"));
+
+    JunctionPointsSel->PushButton4->setIcon(imageImp);
+    JunctionPointsSel->LineEdit4->setReadOnly(true);
+    JunctionPointsSel->LineEdit4->setText("");
+    JunctionPointsSel->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"));
+
+    JunctionPointsSel->PushButton5->setIcon(imageImp);
+    JunctionPointsSel->LineEdit5->setReadOnly(true);
+    JunctionPointsSel->LineEdit5->setText("");
+    JunctionPointsSel->TextLabel5->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"));
+
+    JunctionPointsSel->PushButton6->setAttribute(Qt::WA_DeleteOnClose);
+    JunctionPointsSel->PushButton6->close();
+    JunctionPointsSel->LineEdit6->setAttribute(Qt::WA_DeleteOnClose);
+    JunctionPointsSel->LineEdit6->close();
+    JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
+    JunctionPointsSel->TextLabel6->close();
+
+//     QGridLayout* junctionLayout = (QGridLayout*)JunctionPointsSel->GroupBox1->layout();
+
+//     junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"), JunctionPointsSel->GroupBox1), 3, 0, 1, 1);
+//     
+//     QPushButton* ApplyNewL1 = new QPushButton(centralWidget());
+// //  ApplyNewL1->setText("Apply new L1");
+//     ApplyNewL1->setIcon(imageImp);
+//     junctionLayout->addWidget(ApplyNewL1, 3, 1, 1, 1);
+// 
+//     NewPosValL1 = new QLineEdit(JunctionPointsSel->GroupBox1);
+//     NewPosValL1->setReadOnly(true);
+//     junctionLayout->addWidget(NewPosValL1, 3, 2, 1, 1);
+//     
+//     junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"), JunctionPointsSel->GroupBox1), 4, 0, 1, 1);
+// 
+//     QPushButton* ApplyNewL2 = new QPushButton(centralWidget());
+// //  ApplyNewL2->setText("Apply new L2");
+//     ApplyNewL2->setIcon(imageImp);
+//     junctionLayout->addWidget(ApplyNewL2, 4, 1, 1, 1);
+// 
+//     NewPosValL2 = new QLineEdit(JunctionPointsSel->GroupBox1);
+//     NewPosValL2->setReadOnly(true);
+//     junctionLayout->addWidget(NewPosValL2, 4, 2, 1, 1);
+
+       // 1st row, height = 1, colspan = 3
+       int rowPict = 0, colPict = 0, rowspanPict = 1, colspanPict = 3;
+       // 2nd row, height = 4, col 1
+       int rowMain = rowspanPict,                           colMain = 0,      rowspanMain = 2,      colspanMain = 1;
+       int rowCham = rowspanPict + rowspanMain,             colCham = 0,      rowspanCham = 2,      colspanCham = 1;
+       // 2nd row, height = 4, col 2
+       int rowInc = rowspanPict,                            colInc  = 1,      rowspanInc = 2,       colspanInc = 1;
+       int rowFill = rowspanPict + rowspanInc,              colFill = 1,      rowspanFill = 1,      colspanFill = 1;
+       int rowHex = rowspanPict + rowspanInc + rowspanFill, colHex  = 1,      rowspanHex = 1,       colspanHex = 1;
+       // 2nd row, height = 4, col 3
+       int rowNewPosVal = rowspanPict,                      colNewPosVal = 2, rowspanNewPosVal = 4, colspanNewPosVal = 1;
+
+       myMainLayout->addWidget(PictureView, rowPict, colPict, rowspanPict, colspanPict);
+
+       myMainLayout->addWidget(MainTubeGroupParams, rowMain, colMain, rowspanMain, colspanMain);
+       myMainLayout->addWidget(FilletGroupParams, rowFill, colFill, rowspanFill, colspanFill);
+       myMainLayout->addWidget(HexMeshCheckBox, rowHex, colHex, rowspanHex, colspanHex);
+
+       myMainLayout->addWidget(IncidentTubeGroupParams, rowInc, colInc, rowspanInc, colspanInc);
+       myMainLayout->addWidget(ChamferGroupParams, rowCham, colCham, rowspanCham, colspanCham);
+
+       myMainLayout->addWidget(JunctionPointsSel, rowNewPosVal, colNewPosVal, rowspanNewPosVal, colspanNewPosVal);
+       /***************************************************************/
+
+       setHelpFileName("create_pipe_tshape_page.html");
+
+       Init();
+}
+
+//=================================================================================
+// Destructor
+//=================================================================================
+AdvancedGUI_PipeTShapeDlg::~AdvancedGUI_PipeTShapeDlg() {
+       // no need to delete child widgets, Qt does it all for us
+}
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::Init() {
+       // Get setting of step value from file configuration
+       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+       double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
+
+       PictureView->PipeTShape->setPixmap(imagePipeTShape);
+       PictureView->PipeTShape->adjustSize();
+
+       myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
+       myOkPoint1 = myOkPoint2 = myOkPoint3 = false;
+
+       pipeTShapeGroupObjects.clear();
+
+       // min, max, step and decimals for spin boxes
+       initSpinBox(MainTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(MainTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(MainTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(IncidentTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(IncidentTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(IncidentTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(ChamferGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(ChamferGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
+       initSpinBox(FilletGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
+
+       // init variables
+       MainTubeGroupParams->SpinBox_DX->setValue(80);
+       MainTubeGroupParams->SpinBox_DY->setValue(20);
+       MainTubeGroupParams->SpinBox_DZ->setValue(200);
+       IncidentTubeGroupParams->SpinBox_DX->setValue(50);
+       IncidentTubeGroupParams->SpinBox_DY->setValue(20);
+       IncidentTubeGroupParams->SpinBox_DZ->setValue(200);
+       ChamferGroupParams->SpinBox_DX->setValue(20);
+       ChamferGroupParams->SpinBox_DY->setValue(10);
+       FilletGroupParams->SpinBox_DX->setValue(20);
+
+       // Signal/slot connections
+       connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+       connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+       connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
+       // ValueChangedInSpinBox
+       connect(MainTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(MainTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(IncidentTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(IncidentTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(ChamferGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(ChamferGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       connect(FilletGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+       // ChamferOrFillet
+       connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
+       connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
+       // Preview
+//     connect(PreviewPushButton, SIGNAL(clicked()), this, SLOT(DisplayPreview()));
+       // Position
+       connect(JunctionPointsSel->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(SetPosition(bool)));
+       connect(JunctionPointsSel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+       connect(JunctionPointsSel->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+       connect(JunctionPointsSel->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+    // ApplyNewDimensions
+    connect(JunctionPointsSel->PushButton4, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
+    connect(JunctionPointsSel->PushButton5, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
+       connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(UpdatePicture(QWidget*, QWidget*)));
+       //@@ put additional signal/slot connections here @@//
+
+       initName(tr("GEOM_PIPE_TSHAPE"));
+       DisplayPreview();
+}
+
+//=================================================================================
+// function : ApplyNewDimensions()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::ApplyNewDimensions() {
+    QPushButton* send = (QPushButton*) sender();
+    
+    bool ok = false;
+    double newVal;
+    if (send == JunctionPointsSel->PushButton4) {
+        if (!JunctionPointsSel->LineEdit4->text().isEmpty()) {
+            newVal = JunctionPointsSel->LineEdit4->text().toDouble(&ok);
+            if (ok) {
+                disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
+                MainTubeGroupParams->SpinBox_DZ->setValue(newVal);
+                connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+                MainTubeGroupParams->SpinBox_DZ->setToolTip("");
+                MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
+                CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+                DisplayPreview();
+            }
+        }
+    }
+    else if (send == JunctionPointsSel->PushButton5) {
+        if (!JunctionPointsSel->LineEdit5->text().isEmpty()) {
+            newVal = JunctionPointsSel->LineEdit5->text().toDouble(&ok);
+            if (ok) {
+                disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
+                IncidentTubeGroupParams->SpinBox_DZ->setValue(newVal);
+                connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+                IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
+                IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
+                CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+                DisplayPreview();
+            }
+        }
+    }
+}
+
+//=================================================================================
+// function : UpdatePicture()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::UpdatePicture(QWidget* old, QWidget* now) {
+
+       if (ChamferGroupParams->GroupBox1->isChecked())
+               if (now == MainTubeGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R1"));
+               else if (now == MainTubeGroupParams->SpinBox_DY)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W1"));
+               else if (now == MainTubeGroupParams->SpinBox_DZ)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L1"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R2"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DY)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W2"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DZ)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L2"));
+               else if (now == ChamferGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_H"));
+               else if (now == ChamferGroupParams->SpinBox_DY)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W"));
+               else
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
+       else if (FilletGroupParams->GroupBox1->isChecked())
+               if (now == MainTubeGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R1"));
+               else if (now == MainTubeGroupParams->SpinBox_DY)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W1"));
+               else if (now == MainTubeGroupParams->SpinBox_DZ)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L1"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R2"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DY)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W2"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DZ)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L2"));
+               else if (now == FilletGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_RF"));
+               else
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
+       else
+               if (now == MainTubeGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R1"));
+               else if (now == MainTubeGroupParams->SpinBox_DY)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W1"));
+               else if (now == MainTubeGroupParams->SpinBox_DZ)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L1"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DX)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R2"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DY)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W2"));
+               else if (now == IncidentTubeGroupParams->SpinBox_DZ)
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L2"));
+               else
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
+
+       PictureView->PipeTShape->setPixmap(imagePipeTShape);
+       PictureView->PipeTShape->adjustSize();
+}
+
+//=================================================================================
+// function : SetPosition()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::SetPosition(bool isChecked) {
+       if (isChecked) {
+               erasePreview();
+        JunctionPointsSel->LineEdit4->setText("");
+        JunctionPointsSel->LineEdit5->setText("");
+//             connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(
+//                             SelectionIntoArgument()));
+               JunctionPointsSel->PushButton1->click();
+               SelectionIntoArgument();
+       } else {
+               disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+               JunctionPointsSel->LineEdit4->setText("");
+               JunctionPointsSel->LineEdit5->setText("");
+               DisplayPreview();
+       }
+}
+
+//=================================================================================
+// function : ValueChangedInSpinBox()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox(double newValue)
+{
+    if (myOkPoint1 && myOkPoint2 && myOkPoint3)
+        CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+    DisplayPreview();
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose  : Called when selection as changed or other case
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
+
+       erasePreview();
+//     myEditCurrentArgument->setText("");
+
+       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+       SALOME_ListIO aSelList;
+       aSelMgr->selectedObjects(aSelList);
+
+       if (aSelList.Extent() != 1) {
+               if (myEditCurrentArgument == JunctionPointsSel->LineEdit1)
+                       myOkPoint1 = false;
+               else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2)
+                       myOkPoint2 = false;
+               else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3)
+                       myOkPoint3 = false;
+               return;
+               myEditCurrentArgument->setText("");
+       }
+
+       // nbSel == 1
+       if (aSelList.Extent() == 1) {
+               Standard_Boolean aRes = Standard_False;
+               Handle(SALOME_InteractiveObject) anIO = aSelList.First();
+               GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
+               if (!CORBA::is_nil(aSelectedObject) && aRes) {
+                       QString aName = GEOMBase::GetName(aSelectedObject);
+                       TopoDS_Shape aShape;
+                       if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
+
+                               TColStd_IndexedMapOfInteger aMap;
+                               aSelMgr->GetIndexes(anIO, aMap);
+                               if (aMap.Extent() == 1) { // Local Selection
+                                       int anIndex = aMap(1);
+                                       aName += QString(":vertex_%1").arg(anIndex);
+
+                                       //Find SubShape Object in Father
+                                       GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+                                       if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+                                               GEOM::GEOM_IShapesOperations_var aShapesOp =
+                                                               getGeomEngine()->GetIShapesOperations(getStudyId());
+                                               aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                                       } else {
+                                               aSelectedObject = aFindedObject; // get Object from study
+                                       }
+                                       GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE);
+                               } else { // Global Selection
+                                       if (aShape.ShapeType() != TopAbs_VERTEX) {
+                                               aSelectedObject = GEOM::GEOM_Object::_nil();
+                                               aName = "";
+                                       }
+                               }
+                       }
+
+                       if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
+                               return;
+                       }
+                       myEditCurrentArgument->setText(aName);
+                       if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
+                               myPoint1 = aSelectedObject;
+                               myOkPoint1 = true;
+                               if (!myOkPoint2)
+                                       JunctionPointsSel->PushButton2->click();
+                       } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
+                               myPoint2 = aSelectedObject;
+                               myOkPoint2 = true;
+                               if (!myOkPoint3)
+                                       JunctionPointsSel->PushButton3->click();
+                       } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
+                               myPoint3 = aSelectedObject;
+                               myOkPoint3 = true;
+                               if (!myOkPoint1)
+                                       JunctionPointsSel->PushButton1->click();
+                       }
+               }
+       }
+
+       if (myOkPoint1 && myOkPoint2 && myOkPoint3) {
+        CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+               DisplayPreview();
+    }
+
+//     Standard_Boolean testResult = Standard_False;
+//     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
+//     if (!testResult || aSelectedObject->_is_nil())
+//             return;
+//
+//     myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+//
+//     // clear selection
+//     disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+//     myGeomGUI->getApp()->selectionMgr()->clearSelected();
+//     connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+//
+//     if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
+//             myPoint1 = aSelectedObject;
+//             myOkPoint1 = true;
+//             if (!myOkPoint2)
+//                     JunctionPointsSel->PushButton2->click();
+//             //                      P2GroupParams->PushButton1->click();
+//     } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
+//             //      } else if (myEditCurrentArgument == P2GroupParams->LineEdit1) {
+//             myPoint2 = aSelectedObject;
+//             myOkPoint2 = true;
+//             if (!myOkPoint3)
+//                     JunctionPointsSel->PushButton3->click();
+//             //                      P3GroupParams->PushButton1->click();
+//     } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
+//             //      } else if (myEditCurrentArgument == P3GroupParams->LineEdit1) {
+//             myPoint3 = aSelectedObject;
+//             myOkPoint3 = true;
+//             if (!myOkPoint1)
+//                     JunctionPointsSel->PushButton1->click();
+//     }
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument() {
+       QPushButton* send = (QPushButton*) sender();
+
+       if (send == JunctionPointsSel->PushButton1) {
+               myEditCurrentArgument = JunctionPointsSel->LineEdit1;
+               JunctionPointsSel->PushButton2->setDown(false);
+               JunctionPointsSel->LineEdit2->setEnabled(false);
+               JunctionPointsSel->PushButton3->setDown(false);
+               JunctionPointsSel->LineEdit3->setEnabled(false);
+       } else if (send == JunctionPointsSel->PushButton2) {
+               myEditCurrentArgument = JunctionPointsSel->LineEdit2;
+               JunctionPointsSel->PushButton1->setDown(false);
+               JunctionPointsSel->LineEdit1->setEnabled(false);
+               JunctionPointsSel->PushButton3->setDown(false);
+               JunctionPointsSel->LineEdit3->setEnabled(false);
+       } else if (send == JunctionPointsSel->PushButton3) {
+               myEditCurrentArgument = JunctionPointsSel->LineEdit3;
+               JunctionPointsSel->PushButton1->setDown(false);
+               JunctionPointsSel->LineEdit1->setEnabled(false);
+               JunctionPointsSel->PushButton2->setDown(false);
+               JunctionPointsSel->LineEdit2->setEnabled(false);
+       } 
+
+       // enable line edit
+       myEditCurrentArgument->setEnabled(true);
+       myEditCurrentArgument->setFocus();
+       myEditCurrentArgument->setText("");
+       // after setFocus(), because it will be setDown(false) when loses focus
+       send->setDown(true);
+
+    JunctionPointsSel->LineEdit4->setText("");
+    JunctionPointsSel->LineEdit5->setText("");
+    
+       disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+//     globalSelection(GEOM_POINT);
+    globalSelection(); // close local contexts, if any
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+       connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+}
+
+//=================================================================================
+// function : SetDoubleSpinBoxStep()
+// purpose  : Double spin box management
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::SetDoubleSpinBoxStep(double step) {
+       MainTubeGroupParams->SpinBox_DX->setSingleStep(step);
+       MainTubeGroupParams->SpinBox_DY->setSingleStep(step);
+       MainTubeGroupParams->SpinBox_DZ->setSingleStep(step);
+       IncidentTubeGroupParams->SpinBox_DX->setSingleStep(step);
+       IncidentTubeGroupParams->SpinBox_DY->setSingleStep(step);
+       IncidentTubeGroupParams->SpinBox_DZ->setSingleStep(step);
+       ChamferGroupParams->SpinBox_DX->setSingleStep(step);
+       ChamferGroupParams->SpinBox_DY->setSingleStep(step);
+       FilletGroupParams->SpinBox_DX->setSingleStep(step);
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::ClickOnOk() {
+       if (ClickOnApply())
+               ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() {
+       if (!onAccept())
+               return false;
+
+       initName();
+
+       return true;
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog() {
+       GEOMBase_Skeleton::ActivateThisDialog();
+       //      globalSelection( GEOM_POINT);
+       //      connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(
+       //                      currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+    if (myOkPoint1 && myOkPoint2 && myOkPoint3)
+        CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+       DisplayPreview();
+}
+
+//=================================================================================
+// function : enterEvent [REDEFINED]
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) {
+       if (!mainFrame()->GroupConstructors->isEnabled())
+               ActivateThisDialog();
+}
+
+//=================================================================================
+// function : ChamferOrFillet()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) {
+       QGroupBox* send = (QGroupBox*) sender();
+
+       if (send == ChamferGroupParams->GroupBox1) {
+               if (send->isChecked()) {
+                       disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
+                       FilletGroupParams->GroupBox1->setChecked(false);
+                       connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
+               }
+               else
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
+               PictureView->PipeTShape->setPixmap(imagePipeTShape);
+        if (myOkPoint1 && myOkPoint2 && myOkPoint3)
+            CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+               DisplayPreview();
+       } else if (send == FilletGroupParams->GroupBox1) {
+               if (send->isChecked()) {
+                       disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
+                       ChamferGroupParams->GroupBox1->setChecked(!send->isChecked());
+                       connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
+               }
+               else
+                       imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
+               PictureView->PipeTShape->setPixmap(imagePipeTShape);
+        if (myOkPoint1 && myOkPoint2 && myOkPoint3)
+            CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+               DisplayPreview();
+       }
+
+}
+
+//=================================================================================
+// function : DisplayPreview()
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::DisplayPreview(const bool activate, const bool update, const bool toRemoveFromEngine,
+               const double lineWidth, const int displayMode, const int color) {
+       isPreview = true;
+       QString msg;
+       if (!isValid(msg)) {
+               erasePreview(update);
+               isPreview = false;
+               return;
+       }
+
+       erasePreview(false);
+
+       try {
+               SUIT_OverrideCursor wc;
+               ObjectList objects;
+               bool hexMeshState = HexMeshCheckBox->isChecked();
+               HexMeshCheckBox->setChecked(false);
+               if (!executeNoCheck(objects) || !getOperation()->IsDone()) {
+                       wc.suspend();
+               } else {
+                       ObjectList::iterator it = objects.begin();
+                       GEOM::GEOM_Object_var obj = *it;
+                       displayPreview(obj, true, activate, false, lineWidth, displayMode, color);
+                       if (toRemoveFromEngine)
+                               obj->Destroy();
+               }
+               HexMeshCheckBox->setChecked(hexMeshState);
+       } catch (const SALOME::SALOME_Exception& e) {
+               SalomeApp_Tools::QtCatchCorbaException(e);
+       }
+
+       isPreview = false;
+
+       if (update)
+               updateViewer();
+}
+//=================================================================================
+// function : createOperation
+// purpose  :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() {
+       return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose  :
+//=================================================================================
+bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) {
+       bool ok = true;
+
+       ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
+       ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
+       ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
+       ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
+       ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
+       ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
+       ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
+       ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
+       ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
+
+       ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
+       ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
+       ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
+       ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
+       ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
+       ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
+       ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
+       ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
+       ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
+
+       if (JunctionPointsSel->GroupBox1->isChecked())
+               ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok;
+
+       return ok;
+}
+
+//=================================================================================
+// function : CheckCompatiblePosition()
+// purpose  :
+//=================================================================================
+bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
+               GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) {
+
+       MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
+       IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
+
+    CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
+    CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
+    
+    JunctionPointsSel->LineEdit4->setText("");
+    JunctionPointsSel->LineEdit5->setText("");
+    
+    MainTubeGroupParams->SpinBox_DZ->setToolTip("");
+    IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
+
+       TopoDS_Shape aShape;
+       gp_Pnt P1, P2, P3;
+       if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+               P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
+       else
+               return false;
+
+       if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+               P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
+       else
+               return false;
+
+       if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+               P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
+       else
+               return false;
+
+    double d12 = P1.Distance(P2);
+    double d13 = P1.Distance(P3);
+    double d23 = P2.Distance(P3);
+    
+    if (Abs(d12) <= Precision::Confusion()) {
+//         SetErrorCode("Junctions points P1 and P2 are identical");
+        return false;
+    }
+    if (Abs(d13) <= Precision::Confusion()) {
+//         SetErrorCode("Junctions points P1 and P3 are identical");
+        return false;
+    }
+    if (Abs(d23) <= Precision::Confusion()) {
+//         SetErrorCode("Junctions points P2 and P3 are identical");
+        return false;
+    }
+//     std::cerr << "theL1: " << theL1 << std::endl;
+//     std::cerr << "theL2: " << theL2 << std::endl;
+//     std::cerr << "d12: " << d12 << std::endl;
+//     std::cerr << "d13: " << d13 << std::endl;
+//     std::cerr << "d23: " << d23 << std::endl;
+
+    long double newL1 = 0.5 * d12;
+    long double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
+
+    JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7));
+    JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7));
+//    std::cerr << "newL1: " << newL1 << std::endl;
+//    std::cerr << "newL2: " << newL2 << std::endl;
+
+    if (fabs(newL1 - theL1) > Precision::Approximation()) {
+               if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) &&
+                               (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) {
+//            std::cerr << "theL1 = newL1" << std::endl;
+            disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
+                       MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
+            connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+                       MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
+                       MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);");
+               }
+               else {
+                       MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
+                       MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);");
+               }
+       }
+    else
+               MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
+
+//    std::cerr << "fabs(newL2 - theL2) = " << fabs(newL2 - theL2) << std::endl;
+       if (fabs(newL2 - theL2) > Precision::Approximation()) {
+               if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) &&
+                               (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) {
+//            std::cerr << "theL2 = newL2" << std::endl;
+            disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
+                       IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
+            connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
+                       IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
+                       IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);");
+               }
+               else {
+                       IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
+                       IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);");
+               }
+       }
+       else
+               IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
+
+       return true;
+}
+
+bool AdvancedGUI_PipeTShapeDlg::execute(ObjectList& objects) {
+    
+    if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
+        CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
+
+    return executeNoCheck(objects);
+}
+
+//=================================================================================
+// function : execute
+// purpose  :
+//=================================================================================
+bool AdvancedGUI_PipeTShapeDlg::executeNoCheck(ObjectList& objects) {
+       bool res = false;
+
+       //   GEOM::GEOM_Object_var anObj;
+       GEOM::ListOfGO_var anObj;
+
+       GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
+
+       //@@ retrieve input values from the widgets here @@//
+       CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value();
+       CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value();
+       CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
+       CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value();
+       CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value();
+       CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
+       CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value();
+       CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value();
+       CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value();
+       CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked();
+
+//     if (JunctionPointsSel->GroupBox1->isChecked()) {
+//             CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01);
+//             theL1 = MainTubeGroupParams->SpinBox_DZ->value();
+//             theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
+//     }
+
+       // call engine function
+       if (ChamferGroupParams->GroupBox1->isChecked()) {
+               if (JunctionPointsSel->GroupBox1->isChecked())
+                       anObj = anOper->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
+                                       theHexMesh, myPoint1, myPoint2, myPoint3);
+               else
+                       anObj = anOper->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
+       }
+       else if (FilletGroupParams->GroupBox1->isChecked()) {
+               if (JunctionPointsSel->GroupBox1->isChecked())
+                       anObj = anOper->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF,
+                                       theHexMesh, myPoint1, myPoint2, myPoint3);
+               else
+                       anObj = anOper->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
+       }
+       else {
+               if (JunctionPointsSel->GroupBox1->isChecked())
+               anObj = anOper->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, myPoint1,
+                               myPoint2, myPoint3);
+               else
+                       anObj = anOper->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
+       }
+
+       res = anObj->length();
+       if (!res)
+               return false;
+
+       //   res = !anObj->_is_nil();
+       if (res && !IsPreview()) {
+               QStringList aParameters;
+               //@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
+               aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter
+               aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter
+               aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter
+               aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter
+               aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter
+               aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter
+               if (ChamferGroupParams->GroupBox1->isChecked()) {// Chamfer parameter
+                       aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter
+                       aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter
+               }
+               if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter
+                       aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter
+
+               if (aParameters.count() > 0)
+                       anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData());
+       }
+
+       objects.push_back(anObj[0]._retn());
+       pipeTShapeGroupObjects.clear();
+       for (int i = 1, n = anObj->length(); i < n; i++) {
+               pipeTShapeGroupObjects.push_back(anObj[i]._retn());
+       }
+
+       return objects.size() > 0;
+}
+
+//=================================================================================
+// function : restoreSubShapes
+// purpose  :
+//=================================================================================
+void AdvancedGUI_PipeTShapeDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject) {
+       SALOMEDS::GenericAttribute_var anAttr;
+       if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
+               return;
+
+       SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+       CORBA::String_var anIORso = anAttrIOR->Value();
+
+       // get Object from SObject
+       GEOM::GEOM_Object_var theFather = GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso));
+       if (CORBA::is_nil(theFather))
+               return;
+
+       ObjectList::iterator it = pipeTShapeGroupObjects.begin();
+
+       for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) {
+               //     std::cerr << "Add group " << (*it)->GetName() << std::endl;
+               getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather);
+       }
+
+}
diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h
new file mode 100644 (file)
index 0000000..a0ba4eb
--- /dev/null
@@ -0,0 +1,97 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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
+
+#ifndef ADVANCEDGUI_PIPETSHAPEDLG_H
+#define ADVANCEDGUI_PIPETSHAPEDLG_H
+
+#include <GEOMBase_Skeleton.h>
+
+class DlgRef_1Spin;
+class DlgRef_2Spin;
+class DlgRef_3Spin;
+class DlgRef_3Sel;
+class DlgRef_6Sel;
+class DlgRef_PipeTShape_ScrollArea;
+class QCheckBox;
+class QLineEdit;
+
+//=================================================================================
+// class    : AdvancedGUI_PipeTShapeDlg
+// purpose  :
+//=================================================================================
+class AdvancedGUI_PipeTShapeDlg: public GEOMBase_Skeleton {
+Q_OBJECT
+
+public:
+       AdvancedGUI_PipeTShapeDlg(GeometryGUI*, QWidget* = 0);
+       ~AdvancedGUI_PipeTShapeDlg();
+
+protected:
+       // redefined from GEOMBase_Helper
+       virtual GEOM::GEOM_IOperations_ptr createOperation();
+       virtual bool isValid(QString&);
+       virtual bool execute(ObjectList&);
+       virtual void restoreSubShapes(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
+
+private:
+       void Init();
+       void enterEvent(QEvent*);
+       bool CheckCompatiblePosition(GEOM::GEOM_Object_var theP1, 
+                                 GEOM::GEOM_Object_var theP2,
+                                 GEOM::GEOM_Object_var theP3, double theTolerance);
+
+private:
+       QPixmap imagePipeTShape;
+       DlgRef_PipeTShape_ScrollArea* PictureView;
+       DlgRef_3Spin* MainTubeGroupParams;
+       DlgRef_3Spin* IncidentTubeGroupParams;
+       DlgRef_2Spin* ChamferGroupParams;
+       DlgRef_1Spin* FilletGroupParams;
+       DlgRef_6Sel*  JunctionPointsSel;
+//     QLineEdit* NewPosValL1;
+//     QLineEdit* NewPosValL2;
+//     QPushButton* ApplyNewL1;
+//     QPushButton* ApplyNewL2;
+       QCheckBox* HexMeshCheckBox;
+       GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3;
+       bool myOkPoint1, myOkPoint2, myOkPoint3;
+       bool isPreview;
+       ObjectList pipeTShapeGroupObjects;
+
+private slots:
+       void ClickOnOk();
+       bool ClickOnApply();
+       void ActivateThisDialog();
+       void SelectionIntoArgument();
+       void SetEditCurrentArgument();
+       void DisplayPreview(const bool activate = false, const bool update = true,
+                       const bool toRemoveFromEngine = true, const double lineWidth = -1,
+                       const int displayMode = -1, const int color = -1);
+       void SetPosition(bool);
+       void ChamferOrFillet(bool);
+       void SetDoubleSpinBoxStep(double);
+       void ValueChangedInSpinBox( double );
+       void UpdatePicture(QWidget* old, QWidget* now);
+    void ApplyNewDimensions();
+    bool executeNoCheck( ObjectList& objects );
+};
+
+#endif // ADVANCEDGUI_PIPETSHAPEDLG_H
index 7952de7ba37f45a1089c808da041cc4074ec476b..9dbc363d14e212c53e73aa91ffb16150983ea938 100644 (file)
@@ -30,6 +30,7 @@ salomeinclude_HEADERS =                       \
        AdvancedGUI.h
 
 ADVANCED_INCLUDES  =
+ADVANCED_INCLUDES += AdvancedGUI_PipeTShapeDlg.h
 ##@@ insert new functions before this line @@##
 
 salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
@@ -42,6 +43,7 @@ dist_libAdvancedGUI_la_SOURCES =      \
        AdvancedGUI.cxx
 
 ADVANCED_SOURCES  =
+ADVANCED_SOURCES += AdvancedGUI_PipeTShapeDlg.h AdvancedGUI_PipeTShapeDlg.cxx
 ##@@ insert new functions before this line @@##
 
 dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES)
@@ -49,6 +51,7 @@ dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES)
 MOC_FILES =
 
 ADVANCED_MOC_FILES  =
+ADVANCED_MOC_FILES += AdvancedGUI_PipeTShapeDlg_moc.cxx
 ##@@ insert new functions before this line @@##
 
 MOC_FILES += $(ADVANCED_MOC_FILES)
index ab784081cd5e756623ec275a09fadf2e715cf9f3..f2316d7d76dabcdadaf9b864057feb25e7c1d47d 100644 (file)
@@ -772,6 +772,20 @@ DlgRef_Skeleton::~DlgRef_Skeleton()
 {
 }
 
+//////////////////////////////////////////
+// DlgRef_PipeTShape_ScrollArea
+//////////////////////////////////////////
+
+DlgRef_PipeTShape_ScrollArea::DlgRef_PipeTShape_ScrollArea( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+  setupUi( this );
+}
+
+DlgRef_PipeTShape_ScrollArea::~DlgRef_PipeTShape_ScrollArea()
+{
+}
+
 //////////////////////////////////////////
 // Utility functions
 //////////////////////////////////////////
index b7ec04faab189b3285f0d474730ed1df013590e3..4987ccb97b2bb85bc39ed00581bdb6dd7ca250a8 100644 (file)
@@ -843,6 +843,22 @@ public:
   ~DlgRef_Skeleton();
 };
 
+//////////////////////////////////////////
+// DlgRef_PipeTShape_ScrollArea
+//////////////////////////////////////////
+
+#include "ui_DlgRef_PipeTShape_ScrollArea_QTD.h"
+
+class DLGREF_EXPORT DlgRef_PipeTShape_ScrollArea : public QWidget, 
+                                      public Ui::DlgRef_PipeTShape_ScrollArea_QTD
+{
+  Q_OBJECT
+
+public:
+  DlgRef_PipeTShape_ScrollArea( QWidget* = 0, Qt::WindowFlags = 0 );
+  ~DlgRef_PipeTShape_ScrollArea();
+};
+
 //////////////////////////////////////////
 // Utility functions
 //////////////////////////////////////////
diff --git a/src/DlgRef/DlgRef_PipeTShape_ScrollArea_QTD.ui b/src/DlgRef/DlgRef_PipeTShape_ScrollArea_QTD.ui
new file mode 100644 (file)
index 0000000..9f540e0
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgRef_PipeTShape_ScrollArea_QTD</class>
+ <widget class="QWidget" name="DlgRef_PipeTShape_ScrollArea_QTD">
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <property name="spacing">
+    <number>6</number>
+   </property>
+   <item row="0" column="0">
+    <widget class="QScrollArea" name="ScrollArea">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>250</height>
+      </size>
+     </property>
+     <property name="widgetResizable">
+      <bool>true</bool>
+     </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>110</width>
+        <height>246</height>
+       </rect>
+      </property>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <item>
+        <widget class="QLabel" name="PipeTShape">
+         <property name="text">
+          <string>TextLabel</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index 54cb1abe70d92ec4780ba6dc5cc4ac7985464fd6..8204cdd056a87de1d1caca66ed5ae389346e0536 100644 (file)
@@ -89,6 +89,12 @@ UIC_FILES =                                  \
        ui_DlgRef_6Sel_QTD.h                    \
        ui_DlgRef_Skeleton_QTD.h
 
+ADVANCED_UIC_FILES  = 
+ADVANCED_UIC_FILES += ui_DlgRef_PipeTShape_ScrollArea_QTD.h
+##@@ insert new functions before this line @@##
+
+UIC_FILES += $(ADVANCED_UIC_FILES)
+
 BUILT_SOURCES = $(UIC_FILES)
 
 nodist_libDlgRef_la_SOURCES =  \
index f2e4ad77af2cf106380a045f4afcad659896045e..a3a5211531b3dbb188db6fe57a0c394a979cae50 100644 (file)
             <source>ICON_DLG_SCALE_ALONG_AXES</source>
             <translation>scale_along_axes.png</translation>
         </message>
+        <message>
+            <source>ICON_DLG_PIPETSHAPE</source>
+            <translation>pipetshape.png</translation>
+        </message>
+        <message>
+            <source>ICO_PIPETSHAPE</source>
+            <translation>pipetshape.png</translation>
+        </message>
+        <message>
+            <source>ICO_PIPETSHAPE_IMPORT</source>
+            <translation>pipetshape_import_icon.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE</source>
+            <translation>dlg_pipetshape.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_L1</source>
+            <translation>dlg_pipetshapel1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_R1</source>
+            <translation>dlg_pipetshaper1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_W1</source>
+            <translation>dlg_pipetshapew1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_L2</source>
+            <translation>dlg_pipetshapel2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_R2</source>
+            <translation>dlg_pipetshaper2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_W2</source>
+            <translation>dlg_pipetshapew2.png</translation>
+        </message>
+        
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET</source>
+            <translation>dlg_pipetshapefillet.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET_L1</source>
+            <translation>dlg_pipetshapefilletl1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET_R1</source>
+            <translation>dlg_pipetshapefilletr1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET_W1</source>
+            <translation>dlg_pipetshapefilletw1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET_L2</source>
+            <translation>dlg_pipetshapefilletl2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET_R2</source>
+            <translation>dlg_pipetshapefilletr2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET_W2</source>
+            <translation>dlg_pipetshapefilletw2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_FILLET_RF</source>
+            <translation>dlg_pipetshapefilletrf.png</translation>
+        </message>
+        
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER</source>
+            <translation>dlg_pipetshapechamfer.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_L1</source>
+            <translation>dlg_pipetshapechamferl1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_R1</source>
+            <translation>dlg_pipetshapechamferr1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_W1</source>
+            <translation>dlg_pipetshapechamferw1.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_L2</source>
+            <translation>dlg_pipetshapechamferl2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_R2</source>
+            <translation>dlg_pipetshapechamferr2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_W2</source>
+            <translation>dlg_pipetshapechamferw2.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_H</source>
+            <translation>dlg_pipetshapechamferh.png</translation>
+        </message>
+        <message>
+            <source>DLG_PIPETSHAPE_CHAMFER_W</source>
+            <translation>dlg_pipetshapechamferw.png</translation>
+        </message>
+        
+        <message>
+            <source>ICON_OBJBROWSER_ADVANCED_201</source>
+            <translation>tree_pipetshape.png</translation>
+       </message>
+<!--
+       <message>
+            <source>ICON_DLG_PIPETSHAPEGROUPS</source>
+            <translation>pipetshapegroups.png</translation>
+        </message>
+        <message>
+            <source>ICO_PIPETSHAPEGROUPS</source>
+            <translation>pipetshapegroups.png</translation>
+        </message>
+-->
        <!-- @@ insert new functions before this line @@ -->
     </context>
 </TS>
index bb8bb1b34bc0ac1616d05349c5c73bece7b22529..15cd125ff0b96c9d453aedd06f0076ddf544ffb4 100644 (file)
@@ -4497,5 +4497,143 @@ Would you like to continue?</translation>
             <translation>Load Texture</translation>
         </message>
     </context>
+    <context>
+        <name>AdvancedGUI_PipeTShapeDlg</name>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_TITLE</source>
+            <translation>Pipe TShape Construction</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE</source>
+            <translation>PipeTShape</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_MPIPE</source>
+            <translation>Main pipe</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_R</source>
+            <translation>Radius</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_W</source>
+            <translation>Width</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_L</source>
+            <translation>Half-length</translation>
+           </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_IPIPE</source>
+            <translation>Incident pipe</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_CHAMFER</source>
+            <translation>Chamfer</translation>
+           </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_CHAMFER_H</source>
+            <translation>Height</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_CHAMFER_W</source>
+            <translation>Width</translation>
+        </message>
+           <message>
+            <source>GEOM_PIPE_TSHAPE_FILLET</source>
+            <translation>Fillet</translation>
+           </message>
+           <message>
+            <source>GEOM_PIPE_TSHAPE_HEX</source>
+            <translation>Prepare for hex mesh</translation>
+        </message>
+           <message>
+            <source>GEOM_PIPE_TSHAPE_POSITION</source>
+            <translation>Set position</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_POSITION_P1</source>
+            <translation>Junction P1</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_POSITION_P2</source>
+            <translation>Junction P2</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_POSITION_P3</source>
+            <translation>Junction P3</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
+            <translation>New L1</translation>
+        </message>
+        <message>
+            <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
+            <translation>New L2</translation>
+        </message>
+    </context>
+    <context>
+        <name>@default</name>
+        <message>
+            <source>TOP_PIPETSHAPE</source>
+            <translation>Create Pipe TShape</translation>
+        </message>
+        <message>
+            <source>MEN_PIPETSHAPE</source>
+            <translation>Pipe TShape</translation>
+        </message>
+        <message>
+            <source>STB_PIPETSHAPE</source>
+            <translation>Create new Pipe TShape object</translation>
+           </message>
+           <message>
+            <source>GEOM_ADVANCED_201</source>
+            <translation>Pipe TShape</translation>
+        </message>
+        <message>
+            <source>HALF_LENGTH_MAIN_PIPE</source>
+            <translation>Main pipe half length</translation>
+        </message>
+        <message>
+            <source>HALF_LENGTH_INCIDENT_PIPE</source>
+            <translation>Incident pipe half length</translation>
+        </message>
+        <message>
+            <source>CIRCULAR_QUARTER_PIPE</source>
+            <translation>Circular quarter of pipe</translation>
+        </message>
+        <message>
+            <source>THICKNESS</source>
+            <translation>Thickness</translation>
+        </message>
+        <message>
+            <source>FLANGE</source>
+            <translation>Flange</translation>
+        </message>
+        <message>
+            <source>CHAMFER_OR_FILLET</source>
+            <translation>Chamfer or fillet</translation>
+        </message>
+        <message>
+            <source>CHAMFER</source>
+            <translation>Chamfer</translation>
+        </message>
+        <message>
+            <source>FILLET</source>
+            <translation>Fillet</translation>
+        </message>
+        <message>
+            <source>JUNCTION_FACE_1</source>
+            <translation>Junction 1</translation>
+        </message>
+        <message>
+            <source>JUNCTION_FACE_2</source>
+            <translation>Junction 2</translation>
+        </message>
+        <message>
+            <source>JUNCTION_FACE_3</source>
+            <translation>Junction 3</translation>
+        </message>
+    </context>
     <!-- @@ insert new functions before this line @@ -->
 </TS>
index 5d9f7c09d2329ea863e21d6159d24436acb82dd5..3dbfca536ae9a8a7684be927c1b1849c04193a66 100644 (file)
@@ -501,6 +501,8 @@ void GeometryGUI::OnGUIEvent( int id )
     libName = "BlocksGUI";
     break;
   case GEOMOp::OpAdvancedNoOp:     // NO OPERATION (advanced operations base)
+  case GEOMOp::OpPipeTShape:       // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
+//   case GEOMOp::OpPipeTShapeGroups:     // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
     //@@ insert new functions before this line @@//
     libName = "AdvancedGUI";
     break;
@@ -729,6 +731,8 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpHideChildren,     "POP_HIDE_CHILDREN" );
   createGeomAction( GEOMOp::OpPointMarker,      "POP_POINT_MARKER" );
   
+  createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
+//   createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
   //@@ insert new functions before this line @@//
 
   // ---- create menus --------------------------
@@ -772,6 +776,8 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpPipe,       genId, -1 );
 
   int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
+  createMenu( GEOMOp::OpPipeTShape, advId, -1 );
+//   createMenu( GEOMOp::OpPipeTShapeGroups, advId, -1 );
   //@@ insert new functions before this line @@//
 
   createMenu( separator(), newEntId, -1 );
@@ -977,6 +983,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createTool( GEOMOp::OpCompound, buildTbId );
 
   int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
+  createTool( GEOMOp::OpPipeTShape, advancedTbId );
   //@@ insert new functions before this line @@//
 
   // ---- create popup menus --------------------------
@@ -1049,30 +1056,30 @@ void GeometryGUI::initialize( CAM_Application* app )
 
   QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)";
 
-  int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1);                //select only menu
-  mgr->insert( action(GEOMOp::OpSelectVertex),   selectolnyId, -1);                                  //Vertex
+  int selectonlyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1);                //select only menu
+  mgr->insert( action(GEOMOp::OpSelectVertex),   selectonlyId, -1);                                  //Vertex
   mgr->setRule(action(GEOMOp::OpSelectVertex),   selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectVertex),   selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule);
-  mgr->insert( action(GEOMOp::OpSelectEdge),     selectolnyId, -1);                                  //Edge
+  mgr->insert( action(GEOMOp::OpSelectEdge),     selectonlyId, -1);                                  //Edge
   mgr->setRule(action(GEOMOp::OpSelectEdge),     selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectEdge),     selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule);
-  mgr->insert( action(GEOMOp::OpSelectWire),     selectolnyId, -1);                                  //Wire
+  mgr->insert( action(GEOMOp::OpSelectWire),     selectonlyId, -1);                                  //Wire
   mgr->setRule(action(GEOMOp::OpSelectWire),     selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectWire),     selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule);
-  mgr->insert( action(GEOMOp::OpSelectFace),     selectolnyId, -1);                                  //Face
+  mgr->insert( action(GEOMOp::OpSelectFace),     selectonlyId, -1);                                  //Face
   mgr->setRule(action(GEOMOp::OpSelectFace),     selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectFace),     selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule);
-  mgr->insert( action(GEOMOp::OpSelectShell),    selectolnyId, -1);                                  //Shell
+  mgr->insert( action(GEOMOp::OpSelectShell),    selectonlyId, -1);                                  //Shell
   mgr->setRule(action(GEOMOp::OpSelectShell),    selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectShell),    selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule);
-  mgr->insert( action(GEOMOp::OpSelectSolid),    selectolnyId, -1);                                  //Solid
+  mgr->insert( action(GEOMOp::OpSelectSolid),    selectonlyId, -1);                                  //Solid
   mgr->setRule(action(GEOMOp::OpSelectSolid),    selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectSolid),    selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule);
-  mgr->insert( action(GEOMOp::OpSelectCompound), selectolnyId, -1);                                  //Compound
+  mgr->insert( action(GEOMOp::OpSelectCompound), selectonlyId, -1);                                  //Compound
   mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule);
-  mgr->insert( separator(), selectolnyId, -1);
-  mgr->insert( action(GEOMOp::OpSelectAll),      selectolnyId, -1);                                  //Clear selection filter
+  mgr->insert( separator(), selectonlyId, -1);
+  mgr->insert( action(GEOMOp::OpSelectAll),      selectonlyId, -1);                                  //Clear selection filter
   mgr->setRule(action(GEOMOp::OpSelectAll),      selectOnly, QtxPopupMgr::VisibleRule);
   mgr->setRule(action(GEOMOp::OpSelectAll),      selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
   mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
index c58980b4c51ff914f52a384e789684a8ea0943be..ba01897d9c790ff03ac37992240bc82ece87d506 100644 (file)
@@ -158,6 +158,8 @@ namespace GEOMOp {
     OpExplodeBlock      = 6104,   // MENU BLOCKS - EXPLODE ON BLOCKS
     // AdvancedGUI ---------------//--------------------------------
     OpAdvancedNoOp      = 10000,  // NO OPERATION (advanced operations base)
+    OpPipeTShape        = 10001,  // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
+//     OpPipeTShapeGroups  = 10002,  // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
     //@@ insert new functions before this line @@//
   };
 } 
index 1974fcb661a597290f019a145a942ec2eba32622..cd139c93e39d4b81e2f84978dd20a5e858193794 100644 (file)
@@ -80,6 +80,7 @@
 #include <GEOMImpl_GlueDriver.hxx>
 #include <GEOMImpl_MeasureDriver.hxx>
 // Advanced operations
+#include <GEOMImpl_PipeTShapeDriver.hxx>
 /*@@ insert new functions before this line @@*/
 
 //=============================================================================
@@ -161,6 +162,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
    TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver());
 
    // Advanced operations
+   TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver());
    /*@@ insert new functions before this line @@*/
 
    SetEngine(this);
index 4fff5eee0a9cf14ae5d720fc2d475f950633976d..7dd16e1aeb83841fcffda4a52659afdae70c7111 100644 (file)
 //
 
 #include <Standard_Stream.hxx>
-
+#include "GEOMImpl_IBasicOperations.hxx"
+#include "GEOMImpl_IShapesOperations.hxx"
+#include "GEOMImpl_IBlocksOperations.hxx"
 #include "GEOMImpl_IAdvancedOperations.hxx"
+#include "GEOMImpl_ILocalOperations.hxx"
 #include "GEOMImpl_Types.hxx"
+#include <GEOMImpl_Gen.hxx>
 
 #include <utilities.h>
 #include <OpUtil.hxx>
 #include "GEOM_Function.hxx"
 #include "GEOM_PythonDump.hxx"
 
+#include <GEOMImpl_PipeTShapeDriver.hxx>
+#include <GEOMImpl_IPipeTShape.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Ax3.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+#include <BRep_Tool.hxx>
+#include <cmath>
 /*@@ insert new functions before this line @@*/
 
 #include <TFunction_DriverTable.hxx>
 #include <TDF_Tool.hxx>
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-
+#define HALF_LENGTH_MAIN_PIPE     "Main pipe half length" //"Tuyau principal - demi longueur"
+#define HALF_LENGTH_INCIDENT_PIPE "Incident pipe half length" //"Tuyau incident - demi longueur"
+#define CIRCULAR_QUARTER_PIPE     "Circular quarter of pipe" //"Circulaire - quart de tuyau"
+#define THICKNESS                 "Thickness" //"Epaisseur"
+#define FLANGE                    "Flange" // "Collerette"
+#define CHAMFER_OR_FILLET         "Chamfer or fillet" //"Chanfrein ou Raccord"
+#define JUNCTION_FACE_1           "Junction 1" //"Face de jonction 1"
+#define JUNCTION_FACE_2           "Junction 2" //"Face de jonction 2"
+#define JUNCTION_FACE_3           "Junction 3" //"Face de jonction 3"
 //=============================================================================
 /*!
  *  Constructor
  */
 //=============================================================================
-GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations (GEOM_Engine* theEngine, int theDocID)
-: GEOM_IOperations(theEngine, theDocID)
-{
-  MESSAGE("GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations");
+GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID) :
+    GEOM_IOperations(theEngine, theDocID) {
+    MESSAGE("GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations");
 }
 
 //=============================================================================
@@ -60,9 +86,2244 @@ GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations (GEOM_Engine* theEngi
  *  Destructor
  */
 //=============================================================================
-GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations()
-{
-  MESSAGE("GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations");
+GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations() {
+    MESSAGE("GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations");
+}
+
+//=============================================================================
+/*!
+ *  SetPosition
+ */
+//=============================================================================
+gp_Trsf GEOMImpl_IAdvancedOperations::GetPositionTrsf(double theL1, double theL2, Handle(GEOM_Object) theP1,
+               Handle(GEOM_Object) theP2, Handle(GEOM_Object) theP3) {
+       // Old Local Coordinates System oldLCS
+       gp_Pnt P1(-theL1, 0, 0);
+       gp_Pnt P2(theL1, 0, 0);
+       gp_Pnt P3(0, 0, theL2);
+
+       gp_Dir oldX(gp_Vec(P1, P2));
+       gp_Dir oldZ(gp_Vec(gp::Origin(), P3));
+       gp_Ax3 oldLCS(gp::Origin(), oldZ, oldX);
+
+       // New Local Coordinates System newLCS
+       double LocX, LocY, LocZ;
+       gp_Pnt newP1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
+       gp_Pnt newP2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue()));
+       gp_Pnt newP3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue()));
+       LocX = (newP1.X() + newP2.X()) / 2.;
+       LocY = (newP1.Y() + newP2.Y()) / 2.;
+       LocZ = (newP1.Z() + newP2.Z()) / 2.;
+       gp_Pnt newO(LocX, LocY, LocZ);
+
+       gp_Dir newX(gp_Vec(newP1, newP2)); // P1P2 Vector
+       gp_Dir newZ(gp_Vec(newO, newP3)); // OP3 Vector
+       gp_Ax3 newLCS = gp_Ax3(newO, newZ, newX);
+
+       gp_Trsf aTrsf;
+       aTrsf.SetDisplacement(oldLCS, newLCS);
+
+       return aTrsf;
+}
+
+//=============================================================================
+/*!
+ *  CheckCompatiblePosition
+ *
+ */
+//=============================================================================
+bool GEOMImpl_IAdvancedOperations::CheckCompatiblePosition(double& theL1, double& theL2, Handle(GEOM_Object) theP1,
+        Handle(GEOM_Object) theP2, Handle(GEOM_Object) theP3, double theTolerance) {
+    SetErrorCode(KO);
+    gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
+    gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue()));
+    gp_Pnt P3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue()));
+
+    double d12 = P1.Distance(P2);
+       double d13 = P1.Distance(P3);
+       double d23 = P2.Distance(P3);
+       //    double d2 = newO.Distance(P3);
+//     std::cerr << "theL1: " << theL1 << std::endl;
+//     std::cerr << "theL2: " << theL2 << std::endl;
+//     std::cerr << "d12: " << d12 << std::endl;
+//     std::cerr << "d13: " << d13 << std::endl;
+//     std::cerr << "d23: " << d23 << std::endl;
+
+       if (Abs(d12) <= Precision::Confusion()) {
+        SetErrorCode("Junctions points P1 and P2 are identical");
+        return false;
+    }
+    if (Abs(d13) <= Precision::Confusion()) {
+        SetErrorCode("Junctions points P1 and P3 are identical");
+        return false;
+    }
+    if (Abs(d23) <= Precision::Confusion()) {
+        SetErrorCode("Junctions points P2 and P3 are identical");
+        return false;
+    }
+
+
+    double newL1 = 0.5 * d12;
+    double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
+//    std::cerr << "newL1: " << newL1 << std::endl;
+//    std::cerr << "newL2: " << newL2 << std::endl;
+    //
+    // theL1*(1-theTolerance) <= newL1 <= theL1*(1+theTolerance)
+    //
+//    std::cerr << "1 - theTolerance: " << 1 - theTolerance << std::endl;
+
+//    std::cerr << "fabs(newL1 - theL1): " << fabs(newL1 - theL1) << std::endl;
+    if (fabs(newL1 - theL1) > Precision::Approximation()) {
+        if ( (newL1 * (1 - theTolerance) -theL1 <= Precision::Approximation()) &&
+                       (newL1 * (1 + theTolerance) -theL1 >= Precision::Approximation()) ) {
+//            std::cerr << "theL1 = newL1" << std::endl;
+            theL1 = newL1;
+        } else {
+            theL1 = -1;
+            SetErrorCode("Dimension for main pipe (L1) is incompatible with new position");
+            return false;
+        }
+    }
+
+    //
+    // theL2*(1-theTolerance) <= newL2  <= theL2*(1+theTolerance)
+    //
+//    std::cerr << "fabs(newL2 - theL2): " << fabs(newL2 - theL2) << std::endl;
+    if (fabs(newL2 - theL2) > Precision::Approximation()) {
+        if ( (newL2 * (1 - theTolerance) -theL2 <= Precision::Approximation()) &&
+                       (newL2 * (1 + theTolerance) -theL2 >= Precision::Approximation()) ) {
+//            std::cerr << "theL2 = newL2" << std::endl;
+            theL2 = newL2;
+        } else {
+            theL2 = -1;
+            SetErrorCode("Dimension for incident pipe (L2) is incompatible with new position");
+            return false;
+        }
+    }
+//    std::cerr << "theL1: " << theL1 << std::endl;
+//    std::cerr << "theL2: " << theL2 << std::endl;
+
+    SetErrorCode(OK);
+    return true;
+
+}
+
+//=============================================================================
+/*!
+ *  Generate the propagation groups of a Pipe T-Shape used for hexa mesh
+ */
+//=============================================================================
+bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector<GEOM_IOperations*> theOperations, */Handle(GEOM_Object) theShape,
+        int shapeType, double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, 
+        Handle(TColStd_HSequenceOfTransient) theSeq, gp_Trsf aTrsf) {
+    SetErrorCode(KO);
+
+    if (theShape.IsNull()) return false;
+
+    TopoDS_Shape aShape = theShape->GetValue();
+    if (aShape.IsNull()) {
+        SetErrorCode("Shape is not defined");
+        return false;
+    }
+
+    int expectedGroups = 0;
+    if (shapeType == TSHAPE_BASIC)
+      if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation())
+        expectedGroups = 10;
+      else
+        expectedGroups = 11;
+    else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET)
+      expectedGroups = 12;
+    
+    double aR1Ext = theR1 + theW1;
+    double aR2Ext = theR2 + theW2;
+    
+    /////////////////////////
+    //// Groups of Faces ////
+    /////////////////////////
+/*
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = (GEOMImpl_I3DPrimOperations*) &theOperations[0];
+    GEOMImpl_IBlocksOperations* aBlocksOperations = (GEOMImpl_IBlocksOperations*) &theOperations[2];
+    GEOMImpl_IBooleanOperations* aBooleanOperations = (GEOMImpl_IBooleanOperations*) &theOperations[3];
+    GEOMImpl_IShapesOperations* aShapesOperations = (GEOMImpl_IShapesOperations*) &theOperations[4];
+    GEOMImpl_ITransformOperations* aTransformOperations = (GEOMImpl_ITransformOperations*) &theOperations[5];*/
+
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+    
+    //
+    // Uncomment the following lines when GetInPlace bug is solved
+    // == BEGIN
+    // Workaround of GetInPlace bug
+    // Create a bounding box that fits the shape
+    Handle(GEOM_Object) aBox = a3DPrimOperations->MakeBoxDXDYDZ(2*theL1, 2*aR1Ext, aR1Ext+theL2);
+    aBox->GetLastFunction()->SetDescription("");
+    aTransformOperations->TranslateDXDYDZ(aBox, -theL1, -aR1Ext, -aR1Ext);
+    aBox->GetLastFunction()->SetDescription("");
+    // Get the shell of the box
+    Handle(GEOM_Object) aShell = Handle(GEOM_Object)::DownCast(aShapesOperations->MakeExplode(aBox, TopAbs_SHELL, true)->Value(1));
+    aBox->GetLastFunction()->SetDescription("");
+    aShell->GetLastFunction()->SetDescription("");
+    // Get the common shapes between shell and shape
+    Handle(GEOM_Object) aCommonCompound = aBooleanOperations->MakeBoolean (theShape, aShell, 1); // MakeCommon
+    aCommonCompound->GetLastFunction()->SetDescription("");
+    // Explode the faces of common shapes => 3 faces
+    Handle(TColStd_HSequenceOfTransient) aCommonFaces = aShapesOperations->MakeExplode(aCommonCompound, TopAbs_FACE, true);
+    aCommonCompound->GetLastFunction()->SetDescription("");
+    std::list<Handle(GEOM_Object)> aCompoundOfFacesList;
+    
+//     std::cerr << "aCommonFaces->Length(): " << aCommonFaces->Length() << std::endl;
+    for (int i=0 ; i<= aCommonFaces->Length()-4 ; i+=4) {
+        std::list<Handle(GEOM_Object)> aFacesList;
+//         std::cerr << "Create compound for junction face " << i+1 << std::endl;
+        for (int j = 1 ; j <= 4 ; j++) {
+            Handle(GEOM_Object) aFace = Handle(GEOM_Object)::DownCast(aCommonFaces->Value(i+j)); // Junction faces
+            if (!aFace.IsNull()) {
+                aFace->GetLastFunction()->SetDescription("");
+                aFacesList.push_back(aFace);
+            }
+        }
+        Handle(GEOM_Object) aCompoundOfFaces = aShapesOperations->MakeCompound(aFacesList);
+        if (!aCompoundOfFaces.IsNull()) {
+            aCompoundOfFaces->GetLastFunction()->SetDescription("");
+            // Apply transformation to compound of faces
+            BRepBuilderAPI_Transform aTransformationCompoundOfFaces(aCompoundOfFaces->GetValue(), aTrsf, Standard_False);
+            TopoDS_Shape aTrsf_CompoundOfFacesShape = aTransformationCompoundOfFaces.Shape();
+            aCompoundOfFaces->GetLastFunction()->SetValue(aTrsf_CompoundOfFacesShape);
+            aCompoundOfFacesList.push_back(aCompoundOfFaces);
+        }
+    }
+
+//     std::cerr << "aCompoundOfFacesList.size(): " << aCompoundOfFacesList.size() << std::endl;
+    if (aCompoundOfFacesList.size() == 3) {
+        Handle(GEOM_Object) aPln1 = aCompoundOfFacesList.front();
+        aCompoundOfFacesList.pop_front();
+        Handle(GEOM_Object) aPln2 = aCompoundOfFacesList.front();
+        aCompoundOfFacesList.pop_front();
+        Handle(GEOM_Object) aPln3 = aCompoundOfFacesList.front();
+        aCompoundOfFacesList.pop_front();
+    // == END
+    //
+    
+    
+//     Uncomment the following lines when GetInPlace bug is solved
+//     == BEGIN
+//         Handle(GEOM_Object) aP1 = aBasicOperations->MakePointXYZ(-theL1, 0, 0);
+//         Handle(GEOM_Object) aP2 = aBasicOperations->MakePointXYZ(-0, 0, theL2);
+//         Handle(GEOM_Object) aP3 = aBasicOperations->MakePointXYZ(theL1, 0, 0);
+//         aP1->GetLastFunction()->SetDescription("");
+//         aP2->GetLastFunction()->SetDescription("");
+//         aP3->GetLastFunction()->SetDescription("");
+//         Handle(GEOM_Object) aV1 = aBasicOperations->MakeVectorDXDYDZ(-1, 0, 0);
+//         Handle(GEOM_Object) aV2 = aBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
+//         Handle(GEOM_Object) aV3 = aBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
+//         aV1->GetLastFunction()->SetDescription("");
+//         aV2->GetLastFunction()->SetDescription("");
+//         aV3->GetLastFunction()->SetDescription("");
+//         Handle(GEOM_Object) aPln1 = aBasicOperations->MakePlanePntVec(aP1, aV1, 2*(theR1+theW1+theL2));
+//         Handle(GEOM_Object) aPln2 = aBasicOperations->MakePlanePntVec(aP2, aV2, 2*(theR2+theW2));
+//         Handle(GEOM_Object) aPln3 = aBasicOperations->MakePlanePntVec(aP3, aV3, 2*(theR1+theW1+theL2));
+//         aPln1->GetLastFunction()->SetDescription("");
+//         aPln2->GetLastFunction()->SetDescription("");
+//         aPln3->GetLastFunction()->SetDescription("");
+
+//         BRepBuilderAPI_Transform aTransformation1(aPln1->GetValue(), aTrsf, Standard_False);
+//         TopoDS_Shape aTrsf_Shape1 = aTransformation1.Shape();
+//         aPln1->GetLastFunction()->SetValue(aTrsf_Shape1);
+//         BRepBuilderAPI_Transform aTransformation2(aPln2->GetValue(), aTrsf, Standard_False);
+//         TopoDS_Shape aTrsf_Shape2 = aTransformation2.Shape();
+//         aPln2->GetLastFunction()->SetValue(aTrsf_Shape2);
+//         BRepBuilderAPI_Transform aTransformation3(aPln3->GetValue(), aTrsf, Standard_False);
+//         TopoDS_Shape aTrsf_Shape3 = aTransformation3.Shape();
+//         aPln3->GetLastFunction()->SetValue(aTrsf_Shape3);
+//     == END
+//
+    
+        Handle(GEOM_Object) junctionFaces1 = aShapesOperations->GetInPlace(theShape, aPln1);
+        if (junctionFaces1.IsNull())
+            junctionFaces1 = aShapesOperations->GetShapesOnShapeAsCompound(aPln1, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN);
+        if (!junctionFaces1.IsNull()) {
+            junctionFaces1->GetLastFunction()->SetDescription("");
+            junctionFaces1->SetName("JUNCTION_FACE_1");
+            theSeq->Append(junctionFaces1);
+        }
+        else {
+            SetErrorCode("Junction face 1 not found");
+    //        theSeq->Append(aPln1);
+    //        return false;
+        }
+        Handle(GEOM_Object) junctionFaces2 = aShapesOperations->GetInPlace(theShape, aPln2);
+        if (junctionFaces2.IsNull())
+            junctionFaces2 = aShapesOperations->GetShapesOnShapeAsCompound(aPln2, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN);
+        if (!junctionFaces2.IsNull()) {
+            junctionFaces2->GetLastFunction()->SetDescription("");
+            junctionFaces2->SetName("JUNCTION_FACE_2");
+            theSeq->Append(junctionFaces2);
+        }
+        else {
+            SetErrorCode("Junction face 2 not found");
+    //        theSeq->Append(aPln2);
+    //        return false;
+        }
+        Handle(GEOM_Object) junctionFaces3 = aShapesOperations->GetInPlace(theShape, aPln3);
+        if (junctionFaces3.IsNull())
+            junctionFaces3 = aShapesOperations->GetShapesOnShapeAsCompound(aPln3, theShape, TopAbs_FACE,  GEOMAlgo_ST_ONIN);
+        if (!junctionFaces3.IsNull()) {
+            junctionFaces3->GetLastFunction()->SetDescription("");
+            junctionFaces3->SetName("JUNCTION_FACE_3");
+            theSeq->Append(junctionFaces3);
+        }
+        else {
+            SetErrorCode("Junction face 3 not found");
+    //        theSeq->Append(aPln3);
+    //        return false;
+        }
+    }
+    /////////////////////////
+    //// Groups of Edges ////
+    /////////////////////////
+    // Result of propagate
+    Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+    TCollection_AsciiString theDesc = aFunction->GetDescription();
+    Handle(TColStd_HSequenceOfTransient) aSeqPropagate = aBlocksOperations->Propagate(theShape);
+    if (aSeqPropagate.IsNull() || aSeqPropagate->Length() == 0) {
+        SetErrorCode("Propagation groups not found");
+        return false;
+    }
+    Standard_Integer nbEdges, aNbGroups = aSeqPropagate->Length();
+    // Recover previous description to get rid of Propagate dump
+    aFunction->SetDescription(theDesc);
+    
+    bool addGroup;
+    bool circularFoundAndAdded = false;
+    bool incidentPipeFound = false;
+    bool mainPipeFound = false;
+    bool mainPipeFoundAndAdded = false;
+    bool radialFound =false;
+    bool flangeFound = false;
+    bool flangeFoundAndAdded = false;
+    bool chamferOrFilletFound = false;
+    
+    for (int i=1 ; i<= aNbGroups; i++) {
+      addGroup = false;
+    
+      Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(i));
+      if(aGroup.IsNull())
+        continue;
+      
+      TopoDS_Shape aGroupShape = aGroup->GetValue();
+      
+      TopTools_IndexedMapOfShape anEdgesMap;
+      TopExp::MapShapes(aGroupShape,TopAbs_EDGE, anEdgesMap);
+      nbEdges = anEdgesMap.Extent();
+
+      if (shapeType == TSHAPE_BASIC) {
+        if ((nbEdges == 21) || /*R1Ext = R2Ext*/(nbEdges == 17)){
+          addGroup = true;
+          aGroup->SetName("THICKNESS");
+        }
+        else if (nbEdges == 6) {
+          if (!circularFoundAndAdded) {
+            circularFoundAndAdded = true;
+            addGroup = true;
+            aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+          }
+        }
+        else if (nbEdges == 8) {
+          incidentPipeFound = true;
+          mainPipeFound = false;
+          radialFound =false;
+          flangeFound = false;
+          
+          TopExp_Explorer Ex(aGroupShape,TopAbs_VERTEX);
+          while (Ex.More()) {
+            gp_Pnt aP =  BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+            double x=aP.X(), y=aP.Y(), z=aP.Z();
+            
+            
+            if ((Abs(x) > aR2Ext + Precision::Confusion()) ||
+                (Abs(y) > aR2Ext + Precision::Confusion())) {
+              incidentPipeFound = false;
+            }
+            
+            if ( z < -Precision::Confusion()) {
+              // length of main pipe
+              mainPipeFound = true;
+              if (!mainPipeFoundAndAdded) {
+                mainPipeFoundAndAdded = true;
+                addGroup = true;
+                aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
+              }
+            }
+            
+            else if (Abs(x) > (theL1-Precision::Confusion())) {
+              // discretisation circulaire
+              radialFound = true;
+              if (!circularFoundAndAdded) {
+                circularFoundAndAdded = true;
+                addGroup = true;
+                aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+              }
+            }
+          Ex.Next();
+          }
+          if (incidentPipeFound) {
+            addGroup = true;
+            aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
+          }
+          if (!addGroup && (!incidentPipeFound &&
+              !radialFound &&
+              !mainPipeFound &&
+              !flangeFound)) {
+            // Flange (collerette)
+            flangeFound = true;
+            addGroup = true;
+            aGroup->SetName("FLANGE");
+          }
+        }
+        else
+          continue;
+      }
+      else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) {
+        if (nbEdges == 25) {
+          addGroup = true;
+          aGroup->SetName("THICKNESS");
+        }
+        else if ((nbEdges == 10) || (nbEdges == 6)) {
+          if (!circularFoundAndAdded) {
+            addGroup = true;
+            circularFoundAndAdded = true;
+            aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+          }
+        }
+        else if (nbEdges == 8) {
+          incidentPipeFound = true;
+          mainPipeFound = false;
+          flangeFound = false;
+          
+          TopExp_Explorer Ex(aGroupShape,TopAbs_VERTEX);
+          while (Ex.More()) {
+            gp_Pnt aP =  BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+            double x=aP.X(), y=aP.Y(), z=aP.Z();
+            
+            // tuy_princ_long_avant & tuy_princ_long_apres
+            bool isMain = (((z < Precision::Confusion()) || (x < Precision::Confusion())) &&
+            ((y <= aR1Ext + Precision::Confusion()) ||
+            (y <= -(aR1Ext + Precision::Confusion())) ||
+            (y <= theR1 + Precision::Confusion()) ||
+            (y == -(theR1 + Precision::Confusion()))));
+            
+            
+            if (!isMain) {
+              mainPipeFound = false;
+            }
+            
+            // collerette
+            if (z < Precision::Confusion()) {
+              flangeFound = true;
+              if (!flangeFoundAndAdded) {
+                flangeFoundAndAdded = true;
+                addGroup = true;
+                aGroup->SetName("FLANGE");
+              }
+            }
+            
+            // tuyau incident
+            if ((Abs(x) > aR2Ext + Precision::Confusion()) || 
+                (Abs(y) > aR2Ext + Precision::Confusion())) {
+              incidentPipeFound = false;
+            }
+            Ex.Next();
+          }
+          if (mainPipeFound) {
+            addGroup = true;
+            aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
+          }
+          if (incidentPipeFound) {
+            addGroup = true;
+            aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
+          }
+          if (!addGroup && (!incidentPipeFound &&
+                            !mainPipeFound &&
+                            !flangeFound &&
+                            !chamferOrFilletFound)) {
+            addGroup = true;
+            chamferOrFilletFound = true;
+            if (shapeType == TSHAPE_CHAMFER)
+              aGroup->SetName("CHAMFER");
+            else
+              aGroup->SetName("FILLET");
+          }
+        }
+        else
+          continue;
+      }
+      // Add group to the list
+      if (addGroup)
+        theSeq->Append(aGroup);
+    }
+
+//     Handle(GEOM_Object) aGroup;
+//     if (shapeType == TSHAPE_BASIC) {
+// //         if (aNbGroups != 11) {
+// //             SetErrorCode("Bad number of propagation groups");
+// //             return false;
+// //         }
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(1));
+//         aGroup->SetName("THICKNESS");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(2));
+//         aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(3));
+//         aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(6));
+//         aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(5));
+//         aGroup->SetName("FLANGE");
+//         theSeq->Append(aGroup);
+//     } else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) {
+//         if (aNbGroups != 12) {
+//             SetErrorCode("Bad number of propagation groups");
+//             return false;
+//         }
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(3));
+//         aGroup->SetName("THICKNESS");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(1));
+//         aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(4));
+//         aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(6));
+//         aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(2));
+//         aGroup->SetName("FLANGE");
+//         theSeq->Append(aGroup);
+//         aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(7));
+//         if (shapeType == TSHAPE_CHAMFER)
+//             aGroup->SetName("CHAMFER");
+//         else
+//             aGroup->SetName("FILLET");
+//         theSeq->Append(aGroup);
+//     }
+
+    SetErrorCode(OK);
+    return true;
+}
+
+
+
+bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(/*std::vector<GEOM_IOperations*> theOperations, */Handle(GEOM_Object) theShape, 
+      double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, double theH, double theW, double theRF, bool isNormal) {
+    SetErrorCode(KO);
+/*
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = (GEOMImpl_I3DPrimOperations*) &theOperations[0];
+    GEOMImpl_IBasicOperations* aBasicOperations = (GEOMImpl_IBasicOperations*) &theOperations[1];
+    GEOMImpl_IBlocksOperations* aBlocksOperations = (GEOMImpl_IBlocksOperations*) &theOperations[2];
+    GEOMImpl_IBooleanOperations* aBooleanOperations = (GEOMImpl_IBooleanOperations*) &theOperations[3];
+    GEOMImpl_IShapesOperations* aShapesOperations = (GEOMImpl_IShapesOperations*) &theOperations[4];
+    GEOMImpl_ITransformOperations* aTransformOperations = (GEOMImpl_ITransformOperations*) &theOperations[5];*/
+
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+
+    // Build tools for partition operation:
+    // 1 face and 2 planes
+    // Face
+    Handle(GEOM_Object) arete_intersect_int;
+    Handle(GEOM_Object) wire_t, wire_t2, face_t, face_t2;
+    Handle(GEOM_Object) chan_racc;
+    Handle(GEOM_Object) vi1, vi2;
+
+    Handle(GEOM_Object) Vector_Z = aBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
+    Vector_Z->GetLastFunction()->SetDescription("");
+
+    // Useful values
+    double aSize = 2*(theL1 + theL2);
+    double aR1Ext = theR1 + theW1;
+    double aR2Ext = theR2 + theW2;
+    double theVertCylinderRadius = aR2Ext + theW + theRF;
+    double theHoriCylinderRadius = aR1Ext + theH + theRF;
+
+    // Common edges on internal cylinder
+//    std::cerr << "Search for internal edges" << std::endl;
+    Handle(GEOM_Object) box_i = a3DPrimOperations->MakeBoxDXDYDZ(theR2, theR2, theR1);
+    box_i->GetLastFunction()->SetDescription("");
+    box_i = aTransformOperations->TranslateDXDYDZ(box_i, -theR2, -theR2, 0);
+    box_i->GetLastFunction()->SetDescription("");
+    
+    Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+    TCollection_AsciiString theDesc = aFunction->GetDescription();
+    Handle(TColStd_HSequenceOfTransient) edges_i = aShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+    // Recover previous description to get rid of Propagate dump
+    aFunction->SetDescription(theDesc);
+//     Handle(TColStd_HSequenceOfTransient) edges_i = GetCommonShapesOnCylinders(theShape, TopAbs_EDGE, theR1, theR2);
+    if (edges_i.IsNull() || edges_i->Length() == 0) {
+//        std::cerr << "Internal edges not found" << std::endl;
+        SetErrorCode("Internal edges not found");
+        return false;
+    }
+//    std::cerr << "Internal edges found" << std::endl;
+    for (int i=1; i<=edges_i->Length();i++) {
+        Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_i->Value(i));
+        anObj->GetLastFunction()->SetDescription("");
+    }
+    arete_intersect_int = Handle(GEOM_Object)::DownCast(edges_i->Value(1));
+
+//    std::cerr << "Search for internal vertices" << std::endl;
+    // search for vertices located on both internal pipes
+    aFunction = theShape->GetLastFunction();
+    theDesc = aFunction->GetDescription();
+    Handle(TColStd_HSequenceOfTransient) vertices_i = aShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
+    // Recover previous description to get rid of Propagate dump
+    aFunction->SetDescription(theDesc);
+//     Handle(TColStd_HSequenceOfTransient) vertices_i = GetCommonShapesOnCylinders(theShape, TopAbs_VERTEX, theR1, theR2);
+    if (vertices_i.IsNull() || vertices_i->Length() == 0) {
+//        std::cerr << "Internal vertices not found" << std::endl;
+        SetErrorCode("Internal vertices not found");
+        return false;
+    }
+
+    for (int i = 1; i <= vertices_i->Length(); i++) {
+        Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_i->Value(i));
+        v->GetLastFunction()->SetDescription("");
+        TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
+        gp_Pnt aP = BRep_Tool::Pnt(aVertex);
+        if (Abs(aP.X()) <= Precision::Confusion()) {
+          if (Abs(aP.Y()) - theR2 <= Precision::Confusion())
+            vi1 = v;
+        } else if (Abs(aP.Y()) <= Precision::Confusion()) {
+          if (Abs(aP.X()) - theR1 <= Precision::Confusion())
+            vi2 = v;
+        }
+    }
+//    std::cerr << "Internal vertices found" << std::endl;
+
+    std::list<Handle(GEOM_Object)> theShapes;
+            
+    if (isNormal) {
+        Handle(GEOM_Object) ve1, ve2;
+
+        Handle(GEOM_Object) box_e = a3DPrimOperations->MakeBoxDXDYDZ(aR2Ext, aR2Ext, aR1Ext);
+        box_e->GetLastFunction()->SetDescription("");
+        box_e = aTransformOperations->TranslateDXDYDZ(box_e, -aR2Ext, -aR2Ext, 0);
+        box_e->GetLastFunction()->SetDescription("");
+        // Common edges on external cylinder
+//        std::cerr << "Search for external edges" << std::endl;
+        aFunction = theShape->GetLastFunction();
+        theDesc = aFunction->GetDescription();
+        Handle(TColStd_HSequenceOfTransient) edges_e = aShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+        // Recover previous description to get rid of Propagate dump
+        aFunction->SetDescription(theDesc);
+//         Handle(TColStd_HSequenceOfTransient) edges_e = GetCommonShapesOnCylinders(theShape, TopAbs_EDGE, aR1Ext, aR2Ext);
+        if (edges_e.IsNull() || edges_e->Length() == 0) {
+//            std::cerr << "External edges not found" << std::endl;
+            SetErrorCode("External edges not found");
+            return false;
+        }
+        for (int i=1; i<=edges_e->Length();i++) {
+            Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
+            anObj->GetLastFunction()->SetDescription("");
+        }
+//        std::cerr << "External edges found" << std::endl;
+
+//        std::cerr << "Search for external vertices" << std::endl;
+        // search for vertices located on both external pipes
+        aFunction = theShape->GetLastFunction();
+        theDesc = aFunction->GetDescription();
+        Handle(TColStd_HSequenceOfTransient) vertices_e = aShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
+        // Recover previous description to get rid of Propagate dump
+        aFunction->SetDescription(theDesc);
+//         Handle(TColStd_HSequenceOfTransient) vertices_e = GetCommonShapesOnCylinders(theShape, TopAbs_VERTEX, aR1Ext, aR2Ext);
+        if (vertices_e.IsNull() || vertices_e->Length() == 0) {
+//            std::cerr << "External vertices not found" << std::endl;
+            SetErrorCode("External vertices not found");
+            return false;
+        }
+
+        for (int i = 1; i <= vertices_e->Length(); i++) {
+            Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_e->Value(i));
+            v->GetLastFunction()->SetDescription("");
+            TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
+            gp_Pnt aP = BRep_Tool::Pnt(aVertex);
+            if (Abs(aP.X()) <= Precision::Confusion()) {
+                if (Abs(aP.Y()) - theR2 > Precision::Confusion())
+                    ve1 = v;
+            } else if (Abs(aP.Y()) <= Precision::Confusion()) {
+                if (Abs(aP.X()) - theR2 > Precision::Confusion())
+                    ve2 = v;
+            }
+        }
+//        std::cerr << "External vertices found" << std::endl;
+        Handle(GEOM_Object) edge_e1, edge_e2;
+        try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+            OCC_CATCH_SIGNALS;
+#endif
+            edge_e1 = aBasicOperations->MakeLineTwoPnt(ve1, vi1);
+            if (edge_e1.IsNull()) {
+                SetErrorCode("Edge 1 could not be built");
+                return false;
+            }
+        } catch (Standard_Failure) {
+            Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+            SetErrorCode(aFail->GetMessageString());
+            return false;
+        }
+
+        try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+            OCC_CATCH_SIGNALS;
+#endif
+            edge_e2 = aBasicOperations->MakeLineTwoPnt(ve2, vi2);
+            if (edge_e2.IsNull()) {
+                SetErrorCode("Edge 2 could not be built");
+                return false;
+            }
+        } catch (Standard_Failure) {
+            Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+            SetErrorCode(aFail->GetMessageString());
+            return false;
+        }
+        
+        edge_e1->GetLastFunction()->SetDescription("");
+        edge_e2->GetLastFunction()->SetDescription("");
+
+        std::list<Handle(GEOM_Object)> edge_e_elist;
+        edge_e_elist.push_back(arete_intersect_int);
+        edge_e_elist.push_back(edge_e1);
+        edge_e_elist.push_back(Handle(GEOM_Object)::DownCast(edges_e->Value(1)));
+        edge_e_elist.push_back(edge_e2);
+        wire_t = aShapesOperations->MakeWire(edge_e_elist, 1e-7);
+        if (wire_t.IsNull()) {
+            SetErrorCode("Impossible to build wire");
+            return false;
+        }
+        wire_t->GetLastFunction()->SetDescription("");
+        face_t = aShapesOperations->MakeFace(wire_t, false);
+        if (face_t.IsNull()) {
+            SetErrorCode("Impossible to build face");
+            return false;
+        }
+        face_t->GetLastFunction()->SetDescription("");
+    }
+    else {
+        Handle(GEOM_Object) P1, P2, P3, P4, P5, P6;
+        int idP1, idP2, idP3, idP4;
+        int PZX, PZY;
+        double ZX=0, ZY=0;
+        std::vector<int> LX;
+        std::vector<int> LY;
+//         Handle(TColStd_HSequenceOfTransient) extremVertices;
+        Handle(GEOM_Object) box_e = a3DPrimOperations->MakeBoxDXDYDZ(theVertCylinderRadius, theVertCylinderRadius, theHoriCylinderRadius);
+        box_e->GetLastFunction()->SetDescription("");
+        box_e = aTransformOperations->TranslateDXDYDZ(box_e, -theVertCylinderRadius, -theVertCylinderRadius, 0);
+        box_e->GetLastFunction()->SetDescription("");
+
+        aFunction = theShape->GetLastFunction();
+        theDesc = aFunction->GetDescription();
+        Handle(TColStd_HSequenceOfTransient) extremVertices = aShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
+        // Recover previous description to get rid of Propagate dump
+        aFunction->SetDescription(theDesc);
+        
+//         extremVertices = aShapesOperations->GetShapesOnCylinder(theShape, TopAbs_VERTEX, Vector_Z, theVertCylinderRadius, GEOMAlgo_ST_ONIN);
+        if (extremVertices.IsNull() || extremVertices->Length() == 0) {
+            std::cerr << "extremVertices.IsNull() || extremVertices->Length() == 0" << std::endl;
+            if (theRF == 0)
+                SetErrorCode("Vertices on chamfer not found");
+            else
+                SetErrorCode("Vertices on fillet not found");
+            return false;
+        }
+        
+//         std::cerr << "Found " << extremVertices->Length() << " vertices" << std::endl;
+        theShapes.push_back(theShape);
+        theShapes.push_back(box_e);
+        if (extremVertices->Length() != 6) {
+//           for (int i=1; i<=extremVertices->Length(); i++){
+//             theShapes.push_back(Handle(GEOM_Object)::DownCast(extremVertices->Value(i)));
+//           }
+//           Handle(GEOM_Object) aCompound = aShapesOperations->MakeCompound(theShapes);
+//           TopoDS_Shape aCompoundShape = aCompound->GetValue();
+//           theShape->GetLastFunction()->SetValue(aCompoundShape);
+          SetErrorCode("Bad number of vertices on chamfer found");
+          return false;
+        }
+        
+//         std::cerr << "BEGIN of parsing list of vertices" << std::endl;
+        for (int i=1; i<=extremVertices->Length(); i++){
+            Handle(GEOM_Object) aV = Handle(GEOM_Object)::DownCast(extremVertices->Value(i));
+            aV->GetLastFunction()->SetDescription("");
+//             std::cerr << "Vertex #" <<  i << std::endl;
+            gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aV->GetValue()));
+//             std::cerr << "aP.X() " <<  aP.X() << std::endl;
+//             std::cerr << "aP.Y() " <<  aP.Y() << std::endl;
+//             std::cerr << "aP.Z() " <<  aP.Z() << std::endl;
+//             if (Abs(aP.Z() - theL2) < Precision::Confusion()) {
+// //                std::cerr << "Vertex = L2 ==> OUT" << std::endl;
+//                 continue;
+//             }
+//             if (aP.Z() < 0) {
+// //                std::cerr << "Vertex < 0 ==> OUT" << std::endl;
+//                 continue;
+//             }
+
+            if (Abs(aP.X()) <= Precision::Confusion()) {
+                if (Abs(aP.Y()) - theR2 > Precision::Confusion()) {
+                  LX.push_back(i);
+                  if  (aP.Z()-ZX > Precision::Confusion()) {
+                    ZX = aP.Z();
+                    PZX = i;
+                  }
+                }
+            }
+            else {
+                if (Abs(aP.X()) - theR2 > Precision::Confusion()) {
+                  LY.push_back(i);
+                  if (aP.Z() - ZY > Precision::Confusion()) {
+                    ZY = aP.Z();
+                    PZY = i;
+                  }
+                }
+            }
+        }
+//         std::cerr << "END of parsing list of vertices" << std::endl;
+//         std::cerr << "LX:";
+//         for (int i=0;i<LX.size();i++)
+//           std::cerr << " " << LX.at(i);
+//         std::cerr << std::endl;
+//         std::cerr << "LY:";
+//         for (int i=0;i<LY.size();i++)
+//           std::cerr << " " << LY.at(i);
+//         std::cerr << std::endl;
+//         std::cerr << "PZX: " << PZX << std::endl;
+//         std::cerr << "PZY: " << PZY << std::endl;
+
+        idP2 = PZX;
+        idP4 = PZY;
+        idP1 = LX.at(0);
+        if (LX.at(0) == PZX)
+          idP1 = LX.at(1);
+        idP3 = LY.at(0);
+        if (LY.at(0) == PZY)
+          idP3 = LY.at(1);
+
+//         std::cerr << "idP1: " << idP1 << std::endl;
+//         std::cerr << "idP2: " << idP2 << std::endl;
+//         std::cerr << "idP3: " << idP3 << std::endl;
+//         std::cerr << "idP4: " << idP4 << std::endl;
+
+        P1 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP1));
+        P2 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP2));
+        P3 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP3));
+        P4 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP4));
+
+//         std::cerr << "Building edge 1 in thickness" << std::endl;
+        Handle(GEOM_Object) Cote_1 = aBasicOperations->MakeLineTwoPnt(P1, vi1);
+        if (Cote_1.IsNull()) {
+            SetErrorCode("Impossilbe to build edge in thickness");
+            return false;
+        }
+        Cote_1->GetLastFunction()->SetDescription("");
+        
+//         std::cerr << "Building edge 2 in thickness" << std::endl;
+        Handle(GEOM_Object) Cote_2 = aBasicOperations->MakeLineTwoPnt(vi2, P3);
+        if (Cote_2.IsNull()) {
+            SetErrorCode("Impossilbe to build edge in thickness");
+            return false;
+        }
+        Cote_2->GetLastFunction()->SetDescription("");
+
+        // edge_chan_princ = arete du chanfrein (ou raccord) sur le tuyau principal
+        // edge_chan_inc = arete du chanfrein (ou raccord) sur le tuyau incident
+//         std::cerr << "Getting chamfer edge on main pipe" << std::endl;
+        Handle(GEOM_Object) edge_chan_princ = aBlocksOperations->GetEdge(theShape, P1, P3);
+        if (edge_chan_princ.IsNull()) {
+            SetErrorCode("Impossilbe to find edge on main pipe");
+            return false;
+        }
+        edge_chan_princ->GetLastFunction()->SetDescription("");
+        
+//         std::cerr << "Getting chamfer edge on incident pipe" << std::endl;
+        Handle(GEOM_Object) edge_chan_inc = aBlocksOperations->GetEdge(theShape, P2, P4);
+        if (edge_chan_inc.IsNull()) {
+            SetErrorCode("Impossilbe to find edge on incident pipe");
+            return false;
+        }
+        edge_chan_inc->GetLastFunction()->SetDescription("");
+
+        std::list<Handle(GEOM_Object)> edgeList1;
+        edgeList1.push_back(edge_chan_princ);
+        edgeList1.push_back(Cote_1);
+        edgeList1.push_back(arete_intersect_int);
+        edgeList1.push_back(Cote_2);
+        
+//         std::cerr << "Creating wire 1" << std::endl;
+        wire_t = aShapesOperations->MakeWire(edgeList1, 1e-7);
+        if (wire_t.IsNull()) {
+            SetErrorCode("Impossible to build wire");
+            return false;
+        }
+        wire_t->GetLastFunction()->SetDescription("");
+        
+//         std::cerr << "Creating face 1" << std::endl;
+        face_t = aShapesOperations->MakeFace(wire_t, false);
+        if (face_t.IsNull()) {
+            SetErrorCode("Impossible to build face");
+            return false;
+        }
+        face_t->GetLastFunction()->SetDescription("");
+        theShapes.push_back(face_t);
+          
+        gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(P2->GetValue()));
+        gp_Pnt aP5 = BRep_Tool::Pnt(TopoDS::Vertex(vi1->GetValue()));
+        double deltaZ = aP2.Z() - aP5.Z();
+//         std::cerr << "Creating new point from vi1 with deltaZ = " << deltaZ << std::endl;
+        Handle(GEOM_Object) P5bis = aTransformOperations->TranslateDXDYDZCopy(vi1, 0, 0, deltaZ);
+        if (P5bis.IsNull()) {
+            SetErrorCode("Impossible to translate vertex");
+            return false;
+        }
+        P5bis->GetLastFunction()->SetDescription("");
+
+        gp_Pnt aP4 = BRep_Tool::Pnt(TopoDS::Vertex(P4->GetValue()));
+        gp_Pnt aP6 = BRep_Tool::Pnt(TopoDS::Vertex(vi2->GetValue()));
+        deltaZ = aP4.Z() - aP6.Z();
+//         std::cerr << "Creating new point from vi2 with deltaZ = " << deltaZ << std::endl;
+        Handle(GEOM_Object) P6bis = aTransformOperations->TranslateDXDYDZCopy(vi2, 0, 0, deltaZ);
+        if (P6bis.IsNull()) {
+            SetErrorCode("Impossible to translate vertex");
+            return false;
+        }
+        P6bis->GetLastFunction()->SetDescription("");
+
+//         std::cerr << "Creating new line 1 from 2 previous points" << std::endl;
+        Handle(GEOM_Object) Cote_3 = aBasicOperations->MakeLineTwoPnt(P5bis, P2);
+        if (Cote_3.IsNull()) {
+            SetErrorCode("Impossilbe to build edge in thickness");
+            return false;
+        }
+        Cote_3->GetLastFunction()->SetDescription("");
+        
+//         std::cerr << "Creating new line 2 from 2 previous points" << std::endl;
+        Handle(GEOM_Object) Cote_4 = aBasicOperations->MakeLineTwoPnt(P6bis, P4);
+        if (Cote_4.IsNull()) {
+            SetErrorCode("Impossilbe to build edge in thickness");
+            return false;
+        }
+        Cote_4->GetLastFunction()->SetDescription("");
+        
+//         std::cerr << "Creating new line 3 from 2 previous points" << std::endl;
+        Handle(GEOM_Object) Cote_5 = aBasicOperations->MakeLineTwoPnt(P5bis, P6bis);
+        if (Cote_4.IsNull()) {
+            SetErrorCode("Impossilbe to build edge in thickness");
+            return false;
+        }
+        Cote_5->GetLastFunction()->SetDescription("");
+
+        std::list<Handle(GEOM_Object)> edgeList2;
+        edgeList2.push_back(edge_chan_inc);
+        edgeList2.push_back(Cote_3);
+        edgeList2.push_back(Cote_5);
+        edgeList2.push_back(Cote_4);
+//         std::cerr << "Creating wire 2" << std::endl;
+        wire_t2 = aShapesOperations->MakeWire(edgeList2, 1e-7);
+        if (wire_t2.IsNull()) {
+            SetErrorCode("Impossible to build wire");
+            return false;
+        }
+        wire_t2->GetLastFunction()->SetDescription("");
+//         std::cerr << "Creating face 2" << std::endl;
+        face_t2 = aShapesOperations->MakeFace(wire_t2, false);
+        if (face_t2.IsNull()) {
+            SetErrorCode("Impossible to build face");
+            return false;
+        }
+        face_t2->GetLastFunction()->SetDescription("");
+        theShapes.push_back(face_t2);
+    }
+
+    // Planes
+    Handle(GEOM_Object) aP0 = aBasicOperations->MakePointXYZ(0, 0, 0);
+    Handle(GEOM_Object) aVZ = aBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
+    Handle(GEOM_Object) aVXZ = aBasicOperations->MakeVectorDXDYDZ(aR1Ext, 0, 0.5*(theL1+theVertCylinderRadius));
+    Handle(GEOM_Object) aPlnOZ = aBasicOperations->MakePlanePntVec(aP0, aVZ, aSize);
+    Handle(GEOM_Object) aPlnOXZ = aBasicOperations->MakePlanePntVec(aP0, aVXZ, aSize);
+    aP0->GetLastFunction()->SetDescription("");
+    aVZ->GetLastFunction()->SetDescription("");
+    aVXZ->GetLastFunction()->SetDescription("");
+    aPlnOZ->GetLastFunction()->SetDescription("");
+    aPlnOXZ->GetLastFunction()->SetDescription("");
+    theShapes.push_back(aPlnOZ);
+    theShapes.push_back(aPlnOXZ);
+
+      // Partition
+    Handle(GEOM_Object) Part0 = aBooleanOperations->MakeHalfPartition(theShape, face_t);
+    if (Part0.IsNull()) {
+        std::cerr << "Impossible to build partition between TShape and 1st face" << std::endl;
+        SetErrorCode("Impossible to build partition between TShape and 1st face");
+        return false;
+    }
+    Part0->GetLastFunction()->SetDescription("");
+    
+    Handle(GEOM_Object) Te3 ;
+    if (isNormal) {
+      if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()) {
+        std::cerr << "External radius are identical: we do not make partition with plane OXZ" << std::endl;
+        Te3 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOZ);
+      }
+      else {
+        Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ);
+        if (Part1.IsNull()) {
+          std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl;
+          SetErrorCode("Impossible to build partition between TShape and plane OXZ");
+          return false;
+        }
+        Part1->GetLastFunction()->SetDescription("");
+        Te3 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ);
+      }
+      if (Te3.IsNull()) {
+          std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl;
+          SetErrorCode("Impossible to build partition between TShape and plane OZ");
+          return false;
+      }
+      Te3->GetLastFunction()->SetDescription("");
+    }
+    else {
+      if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()){ // We should never go here
+        SetErrorCode("Impossible to build TShape");
+        return false;
+      }
+      else {
+        Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ);
+        if (Part1.IsNull()) {
+        std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl;
+          SetErrorCode("Impossible to build partition between TShape and plane OXZ");
+          return false;
+        }
+        Part1->GetLastFunction()->SetDescription("");
+        Handle(GEOM_Object) Part2 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ);
+        if (Part2.IsNull()) {
+        std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl;
+          SetErrorCode("Impossible to build partition between TShape and plane OZ");
+          return false;
+        }
+        Part2->GetLastFunction()->SetDescription("");
+        Te3 = aBooleanOperations->MakeHalfPartition(Part2, face_t2);
+        if (Te3.IsNull()) {
+            std::cerr << "Impossible to build partition between TShape and 2nd face" << std::endl;
+            SetErrorCode("Impossible to build partition between TShape and 2nd face");
+            return false;
+        }
+        Te3->GetLastFunction()->SetDescription("");
+      }
+    }
+
+//     Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient;
+//     Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient;
+//     Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient;
+//     Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient;
+//     Handle(TColStd_HArray1OfInteger) theMaterials;
+//     partitionShapes->Append(theShape);
+//     theTools->Append(aPlnOZ);
+//     theTools->Append(aPlnOXZ);
+//     theTools->Append(face_t);
+//     if (!isNormal)
+//         theTools->Append(face_t2);
+//         
+//     Handle(GEOM_Object) Te3 = aBooleanOperations->MakePartition(partitionShapes, theTools, theKeepInside, theRemoveInside, TopAbs_SOLID, false, theMaterials, 0, false);
+//     if (Te3.IsNull()) {
+//         SetErrorCode("Impossible to build partition of TShape");
+//         Handle(GEOM_Object) aCompound = aShapesOperations->MakeCompound(theShapes);
+//         TopoDS_Shape aCompoundShape = aCompound->GetValue();
+//         theShape->GetLastFunction()->SetValue(aCompoundShape);
+//         return false;
+//     }
+//     Te3->GetLastFunction()->SetDescription("");
+//
+
+    TopoDS_Shape aShape = Te3->GetValue();
+    theShape->GetLastFunction()->SetValue(aShape);
+    
+    SetErrorCode(OK);
+    return true;
+}
+
+// Mirror and glue faces
+bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(/*std::vector<GEOM_IOperations*> theOperations, */Handle(GEOM_Object) theShape, 
+      double theR1, double theW1, double theL1, double theR2, double theW2, double theL2) {
+    SetErrorCode(KO);
+    
+    // Useful values
+    double aSize = 2*(theL1 + theL2);
+    double aR1Ext = theR1 + theW1;
+    /*
+    GEOMImpl_IBasicOperations* aBasicOperations = (GEOMImpl_IBasicOperations*) &theOperations[1];
+    GEOMImpl_IShapesOperations* aShapesOperations = (GEOMImpl_IShapesOperations*) &theOperations[4];
+    GEOMImpl_ITransformOperations* aTransformOperations = (GEOMImpl_ITransformOperations*) &theOperations[5];*/
+
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+
+    // Planes
+    Handle(GEOM_Object) aP0 = aBasicOperations->MakePointXYZ(0, 0, 0);
+    aP0->GetLastFunction()->SetDescription("");
+    Handle(GEOM_Object) aVX = aBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
+    Handle(GEOM_Object) aVY = aBasicOperations->MakeVectorDXDYDZ(0, 1, 0);
+    aVX->GetLastFunction()->SetDescription("");
+    aVY->GetLastFunction()->SetDescription("");
+    Handle(GEOM_Object) aPlane_OX = aBasicOperations->MakePlanePntVec(aP0, aVX, 2*(aR1Ext + theL2));
+    Handle(GEOM_Object) aPlane_OY = aBasicOperations->MakePlanePntVec(aP0, aVY, aSize);
+    aPlane_OX->GetLastFunction()->SetDescription("");
+    aPlane_OY->GetLastFunction()->SetDescription("");
+
+    Handle(GEOM_Object) Te4 = aTransformOperations->MirrorPlaneCopy(theShape, aPlane_OX);
+    if (Te4.IsNull()) {
+        SetErrorCode("Impossible to build mirror of quarter TShape");
+        return false;
+    }
+
+//    std::list<Handle(GEOM_Object)> aShapes1, aShapes2;
+//    aShapes1.push_back(Te3);
+//    aShapes1.push_back(Te4);
+//    Handle(GEOM_Object) Te5 = aShapesOperations->MakeCompound(aShapes1);
+//    if (Te4.IsNull()) {
+//        SetErrorCode("Impossible to build compound");
+//        return false;
+//    }
+//    Te5->GetLastFunction()->SetDescription("");
+
+    Handle(GEOM_Object) Te5 = aTransformOperations->MirrorPlaneCopy(theShape, aPlane_OY);
+    if (Te5.IsNull()) {
+        SetErrorCode("Impossible to build mirror of half TShape");
+        return false;
+    }
+
+    Handle(GEOM_Object) Te6 = aTransformOperations->MirrorPlaneCopy(Te4, aPlane_OY);
+    if (Te6.IsNull()) {
+        SetErrorCode("Impossible to build mirror of half TShape");
+        return false;
+    }
+
+    std::list<Handle(GEOM_Object)> aShapesList;
+    aShapesList.push_back(theShape);
+    aShapesList.push_back(Te4);
+    aShapesList.push_back(Te5);
+    aShapesList.push_back(Te6);
+    Handle(GEOM_Object) Te7 = aShapesOperations->MakeCompound(aShapesList);
+    if (Te7.IsNull()) {
+        SetErrorCode("Impossible to build compound");
+        return false;
+    }
+
+    Handle(GEOM_Object) Te8 = aShapesOperations->MakeGlueFaces(Te7, 1e-7, true);
+    if (Te8.IsNull()) {
+        SetErrorCode("Impossible to glue faces of TShape");
+        return false;
+    }
+
+    TopoDS_Shape aShape = Te8->GetValue();
+//     TopTools_IndexedMapOfShape aMapOfShapes;
+//    TopExp::MapShapes(aShape, aMapOfShapes);
+//     TopExp::MapShapes(aShape, TopAbs_COMPOUND, aMapOfShapes);
+
+//    std::cerr << "aMapOfShapes.Extent(): " << aMapOfShapes.Extent() << std::endl;
+//    if (aMapOfShapes.Extent() != 1){
+//        SetErrorCode("Result of partition is not correct");
+//        return false;
+//    }
+
+    theShape->GetLastFunction()->SetValue(aShape);
+
+    Te4->GetLastFunction()->SetDescription("");
+    Te5->GetLastFunction()->SetDescription("");
+    Te6->GetLastFunction()->SetDescription("");
+    Te7->GetLastFunction()->SetDescription("");
+    Te8->GetLastFunction()->SetDescription("");
+
+    SetErrorCode(OK);
+    return true;
+}
+
+//=============================================================================
+/*!
+ *  MakePipeTShape
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length).
+ *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShape(double theR1, double theW1,
+        double theL1, double theR2, double theW2, double theL2, bool theHexMesh) {
+    std::cerr << "GEOMImpl_IAdvancedOperations::MakePipeTShape" << std::endl;
+    SetErrorCode(KO);
+    //Add a new object
+//     std::cerr << "Add a new object" << std::endl;
+    Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+
+    //Add a new shape function with parameters
+//     std::cerr << "Add a new shape function with parameters" << std::endl;
+    Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_BASIC);
+    if (aFunction.IsNull()) return NULL;
+
+    //Check if the function is set correctly
+//     std::cerr << "Check if the function is set correctly" << std::endl;
+    if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+    GEOMImpl_IPipeTShape aData(aFunction);
+
+    aData.SetR1(theR1);
+    aData.SetW1(theW1);
+    aData.SetL1(theL1);
+    aData.SetR2(theR2);
+    aData.SetW2(theW2);
+    aData.SetL2(theL2);
+    aData.SetHexMesh(theHexMesh);
+
+//     std::cerr << "Compute the resulting value" << std::endl;
+    //Compute the resulting value
+    try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        if (!GetSolver()->ComputeFunction(aFunction)) {
+//             SetErrorCode("TShape driver failed");
+            std::cerr << "TShape driver failed" << std::endl;
+            return NULL;
+        }
+//         std::cerr << "aShape->GetName(): " << aShape->GetName() << std::endl;
+    } catch (Standard_Failure) {
+        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+        SetErrorCode(aFail->GetMessageString());
+        return NULL;
+    }
+    
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+    std::vector<GEOM_IOperations*> theOperations;
+    theOperations.push_back(a3DPrimOperations);
+    theOperations.push_back(aBasicOperations);
+    theOperations.push_back(aBlocksOperations);
+    theOperations.push_back(aBooleanOperations);
+    theOperations.push_back(aShapesOperations);
+    theOperations.push_back(aTransformOperations);
+    
+    if (theHexMesh) {
+//         std::cerr << "Creating partition" << std::endl;
+        if (!MakePipeTShapePartition(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+          return NULL;
+//         std::cerr << "Done" << std::endl;
+//         std::cerr << "Creating mirrors and glue" << std::endl;
+        if (!MakePipeTShapeMirrorAndGlue(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+          return NULL;
+//         std::cerr << "Done" << std::endl;
+    }
+
+    Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+//     std::cerr << "Add shape in result list" << std::endl;
+    aSeq->Append(aShape);
+
+    if (theHexMesh) {
+        /*
+         * Get the groups: BEGIN
+         */
+        if (!MakeGroups(/*theOperations, */aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) {
+//            SetErrorCode("Make groups failed");
+            return NULL;
+        }
+
+        TCollection_AsciiString aListRes, anEntry;
+        // Iterate over the sequence aSeq
+        Standard_Integer aNbGroups = aSeq->Length();
+        Standard_Integer i = 2;
+        for (; i <= aNbGroups; i++) {
+            Handle(Standard_Transient) anItem = aSeq->Value(i);
+            if (anItem.IsNull()) continue;
+            Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem);
+            if (aGroup.IsNull()) continue;
+            //Make a Python command
+            TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
+            aListRes += anEntry + ", ";
+        }
+
+        aListRes.Trunc(aListRes.Length() - 2);
+
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << ", " << aListRes.ToCString() << "] = geompy.MakePipeTShape("
+                << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", "
+                << theHexMesh << ")";
+    }
+    /*
+     * Get the groups: END
+     */
+    else {
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << "] = geompy.MakePipeTShape(" << theR1 << ", " << theW1 << ", "
+                << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theHexMesh << ")";
+    }
+
+    SetErrorCode(OK);
+
+    return aSeq;
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length).
+ *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ *  \param theP1 1st junction point of main pipe
+ *  \param theP2 2nd junction point of main pipe
+ *  \param theP3 Junction point of incident pipe
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups..
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1,
+        double theW1, double theL1, double theR2, double theW2, double theL2, bool theHexMesh,
+        Handle(GEOM_Object) theP1, Handle(GEOM_Object) theP2, Handle(GEOM_Object) theP3) {
+    SetErrorCode(KO);
+    //Add a new object
+    Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+    /////////////////
+    // TSHAPE CODE
+    /////////////////
+    //Add a new shape function with parameters
+    Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_BASIC);
+    if (aFunction.IsNull()) return NULL;
+
+    //Check if the function is set correctly
+    if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+    // Check new position
+    if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
+        return NULL;
+    }
+
+    GEOMImpl_IPipeTShape aData(aFunction);
+
+    aData.SetR1(theR1);
+    aData.SetW1(theW1);
+    aData.SetL1(theL1);
+    aData.SetR2(theR2);
+    aData.SetW2(theW2);
+    aData.SetL2(theL2);
+    aData.SetHexMesh(theHexMesh);
+
+    //Compute the resulting value
+    try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        if (!GetSolver()->ComputeFunction(aFunction)) {
+            SetErrorCode("TShape driver failed");
+            return NULL;
+        }
+    } catch (Standard_Failure) {
+        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+        SetErrorCode(aFail->GetMessageString());
+        return NULL;
+    }
+
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+    std::vector<GEOM_IOperations*> theOperations;
+    theOperations.push_back(a3DPrimOperations);
+    theOperations.push_back(aBasicOperations);
+    theOperations.push_back(aBlocksOperations);
+    theOperations.push_back(aBooleanOperations);
+    theOperations.push_back(aShapesOperations);
+    theOperations.push_back(aTransformOperations);
+    
+    if (theHexMesh) {
+        std::cerr << "Creating partition" << std::endl;
+        if (!MakePipeTShapePartition(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+        std::cerr << "Creating mirrors and glue" << std::endl;
+        if (!MakePipeTShapeMirrorAndGlue(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+    }
+
+    TopoDS_Shape Te = aShape->GetValue();
+
+    // Set Position
+    gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
+    BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False);
+    TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
+    aFunction->SetValue(aTrsf_Shape);
+    Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+    aSeq->Append(aShape);
+
+    if (theHexMesh) {
+        //
+        // Get the groups: BEGIN
+        //
+        if (!MakeGroups(/*theOperations, */aShape,TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) {
+//            SetErrorCode("Make groups failed");
+            return NULL;
+        }
+
+        TCollection_AsciiString aListRes, anEntry;
+        // Iterate over the sequence aSeq
+        Standard_Integer aNbGroups = aSeq->Length();
+        Standard_Integer i = 2;
+        for (; i <= aNbGroups; i++) {
+            Handle(Standard_Transient) anItem = aSeq->Value(i);
+            if (anItem.IsNull()) continue;
+            Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem);
+            if (aGroup.IsNull()) continue;
+            //Make a Python command
+            TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
+            aListRes += anEntry + ", ";
+        }
+
+        aListRes.Trunc(aListRes.Length() - 2);
+
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << ", " << aListRes.ToCString() << "] = geompy.MakePipeTShape("
+                << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", "
+                << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")";
+    }
+    //
+    // Get the groups: END
+    //
+
+    else {
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << "] = geompy.MakePipeTShape(" << theR1 << ", " << theW1 << ", "
+                << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theHexMesh << ", " << theP1
+                << ", " << theP2 << ", " << theP3 << ")";
+    }
+
+    SetErrorCode(OK);
+
+    return aSeq;
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length).
+ *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theH Height of chamfer.
+ *  \param theW Width of chamfer.
+ *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1,
+        double theL1, double theR2, double theW2, double theL2, double theH, double theW, bool theHexMesh) {
+    SetErrorCode(KO);
+    //Add a new object
+    Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+    //Add a new shape function with parameters
+    Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_CHAMFER);
+    if (aFunction.IsNull()) return NULL;
+
+    //Check if the function is set correctly
+    if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+    GEOMImpl_IPipeTShape aData(aFunction);
+
+    aData.SetR1(theR1);
+    aData.SetW1(theW1);
+    aData.SetL1(theL1);
+    aData.SetR2(theR2);
+    aData.SetW2(theW2);
+    aData.SetL2(theL2);
+    aData.SetH(theH);
+    aData.SetW(theW);
+    aData.SetHexMesh(theHexMesh);
+
+    //Compute the resulting value
+    try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        if (!GetSolver()->ComputeFunction(aFunction)) {
+            SetErrorCode("TShape driver failed");
+            return NULL;
+        }
+    } catch (Standard_Failure) {
+        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+        SetErrorCode(aFail->GetMessageString());
+        return NULL;
+    }
+
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+    GEOMImpl_ILocalOperations* aLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
+    std::vector<GEOM_IOperations*> theOperations;
+    theOperations.push_back(a3DPrimOperations);
+    theOperations.push_back(aBasicOperations);
+    theOperations.push_back(aBlocksOperations);
+    theOperations.push_back(aBooleanOperations);
+    theOperations.push_back(aShapesOperations);
+    theOperations.push_back(aTransformOperations);
+
+    // BEGIN of chamfer
+    TopoDS_Shape aShapeShape = aShape->GetValue();
+    TopTools_IndexedMapOfShape anEdgesIndices;
+    TopExp::MapShapes(aShapeShape, anEdgesIndices);
+    // Common edges on external cylinders
+    Handle(GEOM_Object) box_e;
+    if (theHexMesh) {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+    }
+    else {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+    }
+    box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+    box_e->GetLastFunction()->SetDescription("");
+    
+    TCollection_AsciiString theDesc = aFunction->GetDescription();
+    Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+    aFunction->SetDescription(theDesc);
+
+    if (edges_e.IsNull() || edges_e->Length() == 0) {
+//        std::cerr << "Internal edges not found" << std::endl;
+        SetErrorCode("External edges not found");
+        return false;
+    }
+//    std::cerr << "External edges found" << std::endl;
+    int nbEdgesInChamfer = 0;
+    std::list<int> theEdges;
+    for (int i=1; i<=edges_e->Length();i++) {
+//         Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
+//         anObj->GetLastFunction()->SetDescription("");
+        int edgeID = edges_e->Value(i);
+//         std::cerr << "Edge #" << edgeID << std::endl;
+        TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+        TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+        int iv=0;
+        while (Ex.More()) {
+          iv ++;
+          gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+//           std::cerr << "Vertex #" << iv << ": aPt.Z() - (theR1+theW1) = " << aPt.Z() - (theR1+theW1) << std::endl;
+          if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+            nbEdgesInChamfer ++;
+            theEdges.push_back(edgeID);
+//             std::cerr << "Edge #" << edgeID << " added" << std::endl;
+          }
+          Ex.Next();
+        }
+        if (theHexMesh && nbEdgesInChamfer == 1)
+          break;
+    }
+    Handle(GEOM_Object) aChamfer;
+    try {
+      aChamfer = aLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
+    }
+    catch (Standard_Failure) {
+      Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+      SetErrorCode(aFail->GetMessageString());
+      try {
+        aChamfer = aLocalOperations->MakeChamferEdges(aShape, theH, theW, theEdges);
+      }
+      catch (Standard_Failure) {
+        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+        SetErrorCode(aFail->GetMessageString());
+        return NULL;
+      }
+    }
+    aChamfer->GetLastFunction()->SetDescription("");
+    
+    TopoDS_Shape aChamferShape = aChamfer->GetValue();
+    aFunction->SetValue(aChamferShape);
+    // END of chamfer
+
+    bool doMesh = false;
+    if (theHexMesh) {
+        doMesh = true;
+        std::cerr << "Creating partition" << std::endl;
+        if (!MakePipeTShapePartition(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false)) {
+            std::cerr << "PipeTShape partition failed" << std::endl;
+            doMesh = false;
+//             return NULL;
+        }
+        std::cerr << "Done" << std::endl;
+        std::cerr << "Creating mirrors and glue" << std::endl;
+        if (!MakePipeTShapeMirrorAndGlue(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2)) {
+          std::cerr << "PipeTShape mirrors and glue failed" << std::endl;
+          doMesh = false;
+//           return NULL;
+        }
+        std::cerr << "Done" << std::endl;
+    }
+
+    Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+    aSeq->Append(aShape);
+
+    if (doMesh) {
+//
+//         Get the groups: BEGIN
+//
+        if (!MakeGroups(/*theOperations, */aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) {
+            //Make a Python command
+            GEOM::TPythonDump(aFunction) << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1
+                    << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW
+                    << ", " << theHexMesh << ")";
+//            return NULL;
+        }
+        else {
+            TCollection_AsciiString aListRes, anEntry;
+            // Iterate over the sequence aSeq
+            Standard_Integer aNbGroups = aSeq->Length();
+            Standard_Integer i = 2;
+            for (; i <= aNbGroups; i++) {
+                Handle(Standard_Transient) anItem = aSeq->Value(i);
+                if (anItem.IsNull()) continue;
+                Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem);
+                if (aGroup.IsNull()) continue;
+                //Make a Python command
+                TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
+                aListRes += anEntry + ", ";
+            }
+
+            aListRes.Trunc(aListRes.Length() - 2);
+
+            //Make a Python command
+            GEOM::TPythonDump(aFunction) << "[" << aShape << ", " << aListRes.ToCString()
+                    << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2
+                    << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW << ", " << theHexMesh << ")";
+        }
+    }
+//
+//     Get the groups: END
+//
+    else {
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1
+                << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW
+                << ", " << theHexMesh << ")";
+    }
+
+    SetErrorCode(OK);
+
+    return aSeq;
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length).
+ *  The T-shape is placed at junction points P1, P2 and P3.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theH Height of chamfer.
+ *  \param theW Width of chamfer.
+ *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ *  \param theP1 1st junction point of main pipe
+ *  \param theP2 2nd junction point of main pipe
+ *  \param theP3 Junction point of incident pipe
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1,
+        double theW1, double theL1, double theR2, double theW2, double theL2, double theH, double theW,
+        bool theHexMesh, Handle(GEOM_Object) theP1, Handle(GEOM_Object) theP2, Handle(GEOM_Object) theP3) {
+    SetErrorCode(KO);
+    //Add a new object
+    Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+    //Add a new shape function with parameters
+    Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_CHAMFER);
+    if (aFunction.IsNull()) return NULL;
+
+    //Check if the function is set correctly
+    if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+    // Check new position
+    if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
+        return NULL;
+    }
+
+    GEOMImpl_IPipeTShape aData(aFunction);
+
+    aData.SetR1(theR1);
+    aData.SetW1(theW1);
+    aData.SetL1(theL1);
+    aData.SetR2(theR2);
+    aData.SetW2(theW2);
+    aData.SetL2(theL2);
+    aData.SetH(theH);
+    aData.SetW(theW);
+    aData.SetHexMesh(theHexMesh);
+
+    //Compute the resulting value
+    try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        if (!GetSolver()->ComputeFunction(aFunction)) {
+            SetErrorCode("TShape driver failed");
+            return NULL;
+        }
+    } catch (Standard_Failure) {
+        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+        SetErrorCode(aFail->GetMessageString());
+        return NULL;
+    }
+
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+    GEOMImpl_ILocalOperations* aLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
+    std::vector<GEOM_IOperations*> theOperations;
+    theOperations.push_back(a3DPrimOperations);
+    theOperations.push_back(aBasicOperations);
+    theOperations.push_back(aBlocksOperations);
+    theOperations.push_back(aBooleanOperations);
+    theOperations.push_back(aShapesOperations);
+    theOperations.push_back(aTransformOperations);
+
+    // BEGIN of chamfer
+    TopoDS_Shape aShapeShape = aShape->GetValue();
+    TopTools_IndexedMapOfShape anEdgesIndices;
+    TopExp::MapShapes(aShapeShape, anEdgesIndices);
+    // Common edges on external cylinders
+    Handle(GEOM_Object) box_e;
+    if (theHexMesh) {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+    }
+    else {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+    }
+    box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+    box_e->GetLastFunction()->SetDescription("");
+    
+    TCollection_AsciiString theDesc = aFunction->GetDescription();
+    Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+    aFunction->SetDescription(theDesc);
+
+    if (edges_e.IsNull() || edges_e->Length() == 0) {
+//        std::cerr << "Internal edges not found" << std::endl;
+        SetErrorCode("External edges not found");
+        return false;
+    }
+//    std::cerr << "External edges found" << std::endl;
+    int nbEdgesInChamfer = 0;
+    std::list<int> theEdges;
+    for (int i=1; i<=edges_e->Length();i++) {
+//         Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
+//         anObj->GetLastFunction()->SetDescription("");
+        int edgeID = edges_e->Value(i);
+        TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+        TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+        while (Ex.More()) {
+          gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+          if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+            nbEdgesInChamfer ++;
+            theEdges.push_back(edgeID);
+          }
+          Ex.Next();
+        }
+        if (theHexMesh && nbEdgesInChamfer == 1)
+          break;
+    }
+    Handle(GEOM_Object) aChamfer;
+    try {
+      aChamfer = aLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
+    }
+    catch (...) {
+      aChamfer = aLocalOperations->MakeChamferEdges(aShape, theH, theW, theEdges);
+    }
+    aChamfer->GetLastFunction()->SetDescription("");
+    
+    TopoDS_Shape aChamferShape = aChamfer->GetValue();
+    aFunction->SetValue(aChamferShape);
+    // END of chamfer
+    
+    if (theHexMesh) {
+        std::cerr << "Creating partition" << std::endl;
+        if (!MakePipeTShapePartition(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+        std::cerr << "Creating mirrors and glue" << std::endl;
+        if (!MakePipeTShapeMirrorAndGlue(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+    }
+
+    TopoDS_Shape Te = aShape->GetValue();
+
+    // Set Position
+    gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
+    BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False);
+    TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
+    aFunction->SetValue(aTrsf_Shape);
+    Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+    aSeq->Append(aShape);
+    if (theHexMesh) {
+        /*
+         * Get the groups: BEGIN
+         */
+        if (!MakeGroups(/*theOperations, */aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf))
+            return NULL;
+
+        TCollection_AsciiString aListRes, anEntry;
+        // Iterate over the sequence aSeq
+        Standard_Integer aNbGroups = aSeq->Length();
+        Standard_Integer i = 2;
+        for (; i <= aNbGroups; i++) {
+            Handle(Standard_Transient) anItem = aSeq->Value(i);
+            if (anItem.IsNull()) continue;
+            Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem);
+            if (aGroup.IsNull()) continue;
+            //Make a Python command
+            TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
+            aListRes += anEntry + ", ";
+        }
+
+        aListRes.Trunc(aListRes.Length() - 2);
+
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << ", " << aListRes.ToCString()
+                << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2
+                << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW << ", " << theHexMesh << ", "
+                << theP1 << ", " << theP2 << ", " << theP3 << ")";
+    }
+    /*
+     * Get the groups: END
+     */
+    else {
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1
+                << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW
+                << ", " << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")";
+    }
+
+    SetErrorCode(OK);
+
+    return aSeq;
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length).A fillet is created on
+ *  the junction of the pipes.
+ *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theRF Radius of curvature of fillet.
+ *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1,
+        double theL1, double theR2, double theW2, double theL2, double theRF, bool theHexMesh) {
+    SetErrorCode(KO);
+    //Add a new object
+    Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+    //Add a new shape function with parameters
+    Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_FILLET);
+    if (aFunction.IsNull()) return NULL;
+
+    //Check if the function is set correctly
+    if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+    GEOMImpl_IPipeTShape aData(aFunction);
+
+    aData.SetR1(theR1);
+    aData.SetW1(theW1);
+    aData.SetL1(theL1);
+    aData.SetR2(theR2);
+    aData.SetW2(theW2);
+    aData.SetL2(theL2);
+    aData.SetRF(theRF);
+    aData.SetHexMesh(theHexMesh);
+
+    //Compute the resulting value
+    try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        if (!GetSolver()->ComputeFunction(aFunction)) {
+            SetErrorCode("TShape driver failed");
+            return NULL;
+        }
+    } catch (Standard_Failure) {
+        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+        SetErrorCode(aFail->GetMessageString());
+        return NULL;
+    }
+
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+    GEOMImpl_ILocalOperations* aLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
+    std::vector<GEOM_IOperations*> theOperations;
+    theOperations.push_back(a3DPrimOperations);
+    theOperations.push_back(aBasicOperations);
+    theOperations.push_back(aBlocksOperations);
+    theOperations.push_back(aBooleanOperations);
+    theOperations.push_back(aShapesOperations);
+    theOperations.push_back(aTransformOperations);
+
+    // BEGIN of fillet
+    TopoDS_Shape aShapeShape = aShape->GetValue();
+    TopTools_IndexedMapOfShape anEdgesIndices;
+    TopExp::MapShapes(aShapeShape, anEdgesIndices);
+    // Common edges on external cylinders
+    Handle(GEOM_Object) box_e;
+    if (theHexMesh) {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+    }
+    else {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+    }
+    box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+    box_e->GetLastFunction()->SetDescription("");
+    
+    TCollection_AsciiString theDesc = aFunction->GetDescription();
+    Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+    aFunction->SetDescription(theDesc);
+
+    if (edges_e.IsNull() || edges_e->Length() == 0) {
+//        std::cerr << "Internal edges not found" << std::endl;
+        SetErrorCode("External edges not found");
+        return false;
+    }
+//    std::cerr << "External edges found" << std::endl;
+    int nbEdgesInFillet = 0;
+    std::list<int> theEdges;
+    for (int i=1; i<=edges_e->Length();i++) {
+//         Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
+//         anObj->GetLastFunction()->SetDescription("");
+        int edgeID = edges_e->Value(i);
+        TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+        TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+        while (Ex.More()) {
+          gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+          if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+            nbEdgesInFillet ++;
+            theEdges.push_back(edgeID);
+          }
+          Ex.Next();
+        }
+        if (theHexMesh && nbEdgesInFillet == 1)
+          break;
+    }
+    
+    Handle(GEOM_Object) aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
+    aFillet->GetLastFunction()->SetDescription("");
+    
+    TopoDS_Shape aFilletShape = aFillet->GetValue();
+    aFunction->SetValue(aFilletShape);
+    // END of fillet
+
+    if (theHexMesh) {
+        std::cerr << "Creating partition" << std::endl;
+        if (!MakePipeTShapePartition(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+        std::cerr << "Creating mirrors and glue" << std::endl;
+        if (!MakePipeTShapeMirrorAndGlue(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+    }
+
+    Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+    aSeq->Append(aShape);
+    if (theHexMesh) {
+        /*
+         * Get the groups: BEGIN
+         */
+        if (!MakeGroups(/*theOperations, */aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf()))
+            return NULL;
+
+        TCollection_AsciiString aListRes, anEntry;
+        // Iterate over the sequence aSeq
+        Standard_Integer aNbGroups = aSeq->Length();
+        Standard_Integer i = 2;
+        for (; i <= aNbGroups; i++) {
+            Handle(Standard_Transient) anItem = aSeq->Value(i);
+            if (anItem.IsNull()) continue;
+            Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem);
+            if (aGroup.IsNull()) continue;
+            //Make a Python command
+            TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
+            aListRes += anEntry + ", ";
+        }
+
+        aListRes.Trunc(aListRes.Length() - 2);
+
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << ", " << aListRes.ToCString()
+                << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2
+                << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " << theHexMesh << ")";
+    }
+    /*
+     * Get the groups: END
+     */
+    else {
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1
+                << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theRF << ", "
+                << theHexMesh << ")";
+    }
+
+
+    SetErrorCode(OK);
+
+    return aSeq;
+
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length). A fillet is created on
+ *  the junction of the pipes.
+ *  The T-shape is placed at junction points P1, P2 and P3.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theRF Radius of curvature of fillet
+ *  \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ *  \param theP1 1st junction point of main pipe
+ *  \param theP2 2nd junction point of main pipe
+ *  \param theP3 Junction point of incident pipe
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1,
+        double theW1, double theL1, double theR2, double theW2, double theL2, double theRF, bool theHexMesh,
+        Handle(GEOM_Object) theP1, Handle(GEOM_Object) theP2, Handle(GEOM_Object) theP3) {
+    SetErrorCode(KO);
+    //Add a new object
+    Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+    //Add a new shape function with parameters
+    Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_FILLET);
+    if (aFunction.IsNull()) return NULL;
+
+    //Check if the function is set correctly
+    if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+    // Check new position
+    if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
+        return NULL;
+    }
+
+    GEOMImpl_IPipeTShape aData(aFunction);
+
+    aData.SetR1(theR1);
+    aData.SetW1(theW1);
+    aData.SetL1(theL1);
+    aData.SetR2(theR2);
+    aData.SetW2(theW2);
+    aData.SetL2(theL2);
+    aData.SetRF(theRF);
+    aData.SetHexMesh(theHexMesh);
+
+    //Compute the resulting value
+    try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+        OCC_CATCH_SIGNALS;
+#endif
+        if (!GetSolver()->ComputeFunction(aFunction)) {
+            SetErrorCode("TShape driver failed");
+            return NULL;
+        }
+    } catch (Standard_Failure) {
+        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+        SetErrorCode(aFail->GetMessageString());
+        return NULL;
+    }
+
+    GEOMImpl_IBasicOperations* aBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBooleanOperations* aBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+    GEOMImpl_IShapesOperations* aShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+    GEOMImpl_ITransformOperations* aTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+    GEOMImpl_IBlocksOperations* aBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+    GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+    GEOMImpl_ILocalOperations* aLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
+    std::vector<GEOM_IOperations*> theOperations;
+    theOperations.push_back(a3DPrimOperations);
+    theOperations.push_back(aBasicOperations);
+    theOperations.push_back(aBlocksOperations);
+    theOperations.push_back(aBooleanOperations);
+    theOperations.push_back(aShapesOperations);
+    theOperations.push_back(aTransformOperations);
+
+    // BEGIN of fillet
+    TopoDS_Shape aShapeShape = aShape->GetValue();
+    TopTools_IndexedMapOfShape anEdgesIndices;
+    TopExp::MapShapes(aShapeShape, anEdgesIndices);
+    // Common edges on external cylinders
+    Handle(GEOM_Object) box_e;
+    if (theHexMesh) {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+    }
+    else {
+      box_e = a3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+    }
+    box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+    box_e->GetLastFunction()->SetDescription("");
+    
+    TCollection_AsciiString theDesc = aFunction->GetDescription();
+    Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+    aFunction->SetDescription(theDesc);
+
+    if (edges_e.IsNull() || edges_e->Length() == 0) {
+//        std::cerr << "Internal edges not found" << std::endl;
+        SetErrorCode("External edges not found");
+        return false;
+    }
+//    std::cerr << "External edges found" << std::endl;
+    int nbEdgesInFillet = 0;
+    std::list<int> theEdges;
+    for (int i=1; i<=edges_e->Length();i++) {
+//         Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
+//         anObj->GetLastFunction()->SetDescription("");
+        int edgeID = edges_e->Value(i);
+        TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+        TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+        while (Ex.More()) {
+          gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+          if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+            nbEdgesInFillet ++;
+            theEdges.push_back(edgeID);
+          }
+          Ex.Next();
+        }
+        if (theHexMesh && nbEdgesInFillet == 1)
+          break;
+    }
+    
+    Handle(GEOM_Object) aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
+    aFillet->GetLastFunction()->SetDescription("");
+    
+    TopoDS_Shape aFilletShape = aFillet->GetValue();
+    aFunction->SetValue(aFilletShape);
+    // END of fillet
+
+    if (theHexMesh) {
+        std::cerr << "Creating partition" << std::endl;
+        if (!MakePipeTShapePartition(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+        std::cerr << "Creating mirrors and glue" << std::endl;
+        if (!MakePipeTShapeMirrorAndGlue(/*theOperations, */aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+          return NULL;
+        std::cerr << "Done" << std::endl;
+    }
+
+    TopoDS_Shape Te = aShape->GetValue();
+
+    // Set Position
+    gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
+    BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False);
+    TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
+    aFunction->SetValue(aTrsf_Shape);
+    Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+    aSeq->Append(aShape);
+    if (theHexMesh) {
+        /*
+         * Get the groups: BEGIN
+         */
+        if (!MakeGroups(/*theOperations, */aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf))
+            return NULL;
+
+        TCollection_AsciiString aListRes, anEntry;
+        // Iterate over the sequence aSeq
+        Standard_Integer aNbGroups = aSeq->Length();
+        Standard_Integer i = 2;
+        for (; i <= aNbGroups; i++) {
+            Handle(Standard_Transient) anItem = aSeq->Value(i);
+            if (anItem.IsNull()) continue;
+            Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem);
+            if (aGroup.IsNull()) continue;
+            //Make a Python command
+            TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
+            aListRes += anEntry + ", ";
+        }
+
+        aListRes.Trunc(aListRes.Length() - 2);
+
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << ", " << aListRes.ToCString()
+                << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2
+                << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " << theHexMesh << ", " << theP1 << ", "
+                << theP2 << ", " << theP3 << ")";
+    }
+    /*
+     * Get the groups: END
+     */
+    else {
+        //Make a Python command
+        GEOM::TPythonDump(aFunction) << "[" << aShape << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1
+                << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theRF << ", "
+                << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")";
+    }
+
+    SetErrorCode(OK);
+
+    return aSeq;
 }
 
 /*@@ insert new functions before this line @@*/
index 997023edceddbccb300305e8539f71599709d2ac..312ef642cb59ecd4f2b1e69f21db15a65ec6446e 100644 (file)
 #include "GEOM_Engine.hxx"
 #include "GEOM_Object.hxx"
 
-class GEOMImpl_IAdvancedOperations : public GEOM_IOperations
-{
+#define Handle_GEOM_Object Handle(GEOM_Object)
+#define Handle_TColStd_HSequenceOfTransient Handle(TColStd_HSequenceOfTransient)
+#define Handle_TColStd_HSequenceOfInteger Handle(TColStd_HSequenceOfInteger)
+
+class GEOMImpl_IAdvancedOperations: public GEOM_IOperations {
+private:
+       bool MakePipeTShapePartition(/*std::vector<GEOM_IOperations*> theOperations, */Handle_GEOM_Object theShape, double theR1, double theW1, double theL1, double theR2,
+                       double theW2, double theL2, double theH = 0, double theW = 0, double theRF = 0, bool isNormal = true);
+    bool MakePipeTShapeMirrorAndGlue(/*std::vector<GEOM_IOperations*> theOperations, */Handle_GEOM_Object theShape, double theR1, double theW1, double theL1, double theR2,
+            double theW2, double theL2);
+       bool MakeGroups(/*std::vector<GEOM_IOperations*> theOperations, */Handle_GEOM_Object theShape, int shapType, double theR1, double theW1, double theL1, double theR2,
+                       double theW2, double theL2, Handle_TColStd_HSequenceOfTransient theSeq, gp_Trsf aTrsf);
+       gp_Trsf GetPositionTrsf(double theL1, double theL2, Handle_GEOM_Object P1 = NULL, Handle_GEOM_Object P2 = NULL,
+                       Handle_GEOM_Object P3 = NULL);
+    bool CheckCompatiblePosition(double& theL1, double& theL2, Handle_GEOM_Object theP1, Handle_GEOM_Object theP2,
+            Handle_GEOM_Object theP3, double theTolerance);
+
 public:
-  Standard_EXPORT GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID);
-  Standard_EXPORT ~GEOMImpl_IAdvancedOperations();
+       Standard_EXPORT
+       GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID);Standard_EXPORT
+       ~GEOMImpl_IAdvancedOperations();
 
-  /*@@ insert new functions before this line @@*/
+       Standard_EXPORT Handle_TColStd_HSequenceOfTransient MakePipeTShape(double theR1, double theW1, double theL1,
+                       double theR2, double theW2, double theL2, bool theHexMesh = true);
+       Standard_EXPORT Handle_TColStd_HSequenceOfTransient
+       MakePipeTShapeWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2,
+                       bool theHexMesh = true, Handle_GEOM_Object P1 = NULL, Handle_GEOM_Object P2 = NULL, Handle_GEOM_Object P3 =
+                                       NULL);
+       Standard_EXPORT Handle_TColStd_HSequenceOfTransient MakePipeTShapeChamfer(double theR1, double theW1, double theL1,
+                       double theR2, double theW2, double theL2, double theH, double theW, bool theHexMesh = true);
+       Standard_EXPORT Handle_TColStd_HSequenceOfTransient
+       MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2,
+                       double theL2, double theH, double theW, bool theHexMesh = true, Handle_GEOM_Object P1 = NULL,
+                       Handle_GEOM_Object P2 = NULL, Handle_GEOM_Object P3 = NULL);
+       Standard_EXPORT Handle_TColStd_HSequenceOfTransient MakePipeTShapeFillet(double theR1, double theW1, double theL1,
+                       double theR2, double theW2, double theL2, double theRF, bool theHexMesh = true);
+       Standard_EXPORT Handle_TColStd_HSequenceOfTransient
+       MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2,
+                       double theL2, double theRF, bool theHexMesh = true, Handle_GEOM_Object P1 = NULL, Handle_GEOM_Object P2 =
+                                       NULL, Handle_GEOM_Object P3 = NULL);
+       /*@@ insert new functions before this line @@*/
 };
 
+#undef Handle_GEOM_Object
+#undef Handle_TColStd_HSequenceOfTransient
+#undef Handle_TColStd_HSequenceOfInteger
+
 #endif
diff --git a/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx b/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx
new file mode 100644 (file)
index 0000000..1805597
--- /dev/null
@@ -0,0 +1,97 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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
+
+#ifndef _GEOMImpl_IPipeTShape_HXX_
+#define _GEOMImpl_IPipeTShape_HXX_
+
+#include "GEOM_Function.hxx"
+
+#define TSHAPE_ARG_R1   1
+#define TSHAPE_ARG_W1   2
+#define TSHAPE_ARG_L1   3
+#define TSHAPE_ARG_R2   4
+#define TSHAPE_ARG_W2   5
+#define TSHAPE_ARG_L2   6
+
+// chamfer
+#define TSHAPE_ARG_H    7
+#define TSHAPE_ARG_W    8
+
+// fillet
+#define TSHAPE_ARG_RF   9
+
+// partition
+#define TSHAPE_ARG_HEXMESH 10
+
+// junction points
+#define TSHAPE_ARG_P1 11
+#define TSHAPE_ARG_P2 12
+#define TSHAPE_ARG_P3 13
+
+class GEOMImpl_IPipeTShape
+{
+public:
+  GEOMImpl_IPipeTShape(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+  void SetR1(double theR1) { _func->SetReal(TSHAPE_ARG_R1, theR1); }
+  double GetR1() { return _func->GetReal(TSHAPE_ARG_R1); }
+
+  void SetW1(double theW1) { _func->SetReal(TSHAPE_ARG_W1, theW1); }
+  double GetW1() { return _func->GetReal(TSHAPE_ARG_W1); }
+
+  void SetL1(double theL1) { _func->SetReal(TSHAPE_ARG_L1, theL1); }
+  double GetL1() { return _func->GetReal(TSHAPE_ARG_L1); }
+
+  void SetR2(double theR2) { _func->SetReal(TSHAPE_ARG_R2, theR2); }
+  double GetR2() { return _func->GetReal(TSHAPE_ARG_R2); }
+
+  void SetW2(double theW2) { _func->SetReal(TSHAPE_ARG_W2, theW2); }
+  double GetW2() { return _func->GetReal(TSHAPE_ARG_W2); }
+
+  void SetL2(double theL2) { _func->SetReal(TSHAPE_ARG_L2, theL2); }
+  double GetL2() { return _func->GetReal(TSHAPE_ARG_L2); }
+
+  void SetH(double theH) { _func->SetReal(TSHAPE_ARG_H, theH); }
+  double GetH() { return _func->GetReal(TSHAPE_ARG_H); }
+
+  void SetW(double theW) { _func->SetReal(TSHAPE_ARG_W, theW); }
+  double GetW() { return _func->GetReal(TSHAPE_ARG_W); }
+
+  void SetRF(double theRF) { _func->SetReal(TSHAPE_ARG_RF, theRF); }
+  double GetRF() { return _func->GetReal(TSHAPE_ARG_RF); }
+
+  void SetHexMesh(int theHexMesh) { _func->SetInteger(TSHAPE_ARG_HEXMESH, theHexMesh); }
+  int GetHexMesh() { return _func->GetInteger(TSHAPE_ARG_HEXMESH); }
+
+  void SetP1(const Handle(GEOM_Function)& theP1){_func->SetReference(TSHAPE_ARG_P1, theP1); }
+  Handle(GEOM_Function) GetP1() { return _func->GetReference(TSHAPE_ARG_P1); }
+
+  void SetP2(const Handle(GEOM_Function)& theP2){_func->SetReference(TSHAPE_ARG_P2, theP2); }
+  Handle(GEOM_Function) GetP2() { return _func->GetReference(TSHAPE_ARG_P2); }
+
+  void SetP3(const Handle(GEOM_Function)& theP3){_func->SetReference(TSHAPE_ARG_P3, theP3); }
+  Handle(GEOM_Function) GetP3() { return _func->GetReference(TSHAPE_ARG_P3); }
+
+private:
+  Handle(GEOM_Function) _func;
+};
+
+#endif // _GEOMImpl_IPipeTShape_HXX_
diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx
new file mode 100644 (file)
index 0000000..4353e2b
--- /dev/null
@@ -0,0 +1,673 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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
+
+#include <Standard_Stream.hxx>
+
+#include <GEOMImpl_PipeTShapeDriver.hxx>
+#include <GEOMImpl_IPipeTShape.hxx>
+#include <GEOMImpl_Types.hxx>
+
+#include <GEOMImpl_Block6Explorer.hxx>
+#include <GEOM_Function.hxx>
+
+#include <GEOMImpl_IShapesOperations.hxx>
+#include "GEOMAlgo_FinderShapeOn1.hxx"
+#include "GEOMAlgo_FinderShapeOn2.hxx"
+#include <GEOMAlgo_ClsfBox.hxx>
+#include <GEOMAlgo_Gluer.hxx>
+
+#include <TFunction_Logbook.hxx>
+#include <StdFail_NotDone.hxx>
+
+// Partition includes
+#include <GEOMAlgo_Splitter.hxx>
+#include <Geom_CylindricalSurface.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Ax2.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Trsf.hxx>
+
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepFilletAPI_MakeFillet.hxx>
+#include <BRepFilletAPI_MakeChamfer.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
+#include <TopoDS.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+#include <vector>
+//@@ include required header files here @@//
+
+//=======================================================================
+//function : GetID
+//purpose  :
+//=======================================================================
+const Standard_GUID& GEOMImpl_PipeTShapeDriver::GetID()
+{
+  static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
+  return aGUID;
+}
+
+//=======================================================================
+//function : GEOMImpl_PipeTShapeDriver
+//purpose  :
+//=======================================================================
+GEOMImpl_PipeTShapeDriver::GEOMImpl_PipeTShapeDriver()
+{
+}
+
+//=======================================================================
+//function : getShapesOnBoxIDs
+  /*!
+   * \brief Find IDs of subshapes complying with given status about surface
+    * \param theBox - the box to check state of subshapes against
+    * \param theShape - the shape to explore
+    * \param theShapeType - type of subshape of theShape
+    * \param theState - required state
+    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+   */
+//=======================================================================
+Handle(TColStd_HSequenceOfInteger)
+GEOMImpl_PipeTShapeDriver::GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
+                    const TopoDS_Shape& aShape,
+                    const Standard_Integer theShapeType,
+                    GEOMAlgo_State theState) const
+{
+  Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
+
+  // Check presence of triangulation, build if need
+  if (!GEOMImpl_IShapesOperations::CheckTriangulation(aShape)) {
+    StdFail_NotDone::Raise("Cannot build triangulation on the shape");
+    return aSeqOfIDs;
+  }
+
+  // Call algo
+  GEOMAlgo_FinderShapeOn2 aFinder;
+  Standard_Real aTol = 0.0001; // default value
+
+  Handle(GEOMAlgo_ClsfBox) aClsfBox = new GEOMAlgo_ClsfBox;
+  aClsfBox->SetBox(aBox);
+
+  aFinder.SetShape(aShape);
+  aFinder.SetTolerance(aTol);
+  aFinder.SetClsf(aClsfBox);
+  aFinder.SetShapeType( (TopAbs_ShapeEnum)theShapeType );
+  aFinder.SetState(theState);
+  aFinder.Perform();
+
+  // Interprete results
+  Standard_Integer iErr = aFinder.ErrorStatus();
+  // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+  if (iErr) {
+    TCollection_AsciiString aMsg (" iErr : ");
+    aMsg += TCollection_AsciiString(iErr);
+    StdFail_NotDone::Raise(aMsg.ToCString());
+    return aSeqOfIDs;
+  }
+
+
+  const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
+
+  if (listSS.Extent() < 1) {
+    StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
+    return aSeqOfIDs;
+  }
+
+  // Fill sequence of object IDs
+  aSeqOfIDs = new TColStd_HSequenceOfInteger;
+
+  TopTools_IndexedMapOfShape anIndices;
+  TopExp::MapShapes(aShape, anIndices);
+
+  TopTools_ListIteratorOfListOfShape itSub (listSS);
+  for (int index = 1; itSub.More(); itSub.Next(), ++index) {
+    int id = anIndices.FindIndex(itSub.Value());
+    std::cerr << "Shape with ID " << id << " found" << std::endl;
+//     TopoDS_Shape s = anIndices.FindKey(id);
+    aSeqOfIDs->Append(id);
+//     aSeqOfIDs->Append(itSub.Value());
+  }
+
+  return aSeqOfIDs;
+}
+
+//=======================================================================
+//function : GetShapesOnSurfaceIDs
+  /*!
+   * \brief Find IDs of subshapes complying with given status about surface
+    * \param theSurface - the surface to check state of subshapes against
+    * \param theShape - the shape to explore
+    * \param theShapeType - type of subshape of theShape
+    * \param theState - required state
+    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+   */
+//=======================================================================
+Handle(TColStd_HSequenceOfInteger)
+  GEOMImpl_PipeTShapeDriver::GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
+                                                    const TopoDS_Shape&         theShape,
+                                                    TopAbs_ShapeEnum            theShapeType,
+                                                    GEOMAlgo_State              theState) const
+{
+  Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
+
+  // Check presence of triangulation, build if need
+  if (!GEOMImpl_IShapesOperations::CheckTriangulation(theShape)) {
+    StdFail_NotDone::Raise("Cannot build triangulation on the shape");
+    return aSeqOfIDs;
+  }
+
+  // Call algo
+  GEOMAlgo_FinderShapeOn1 aFinder;
+  Standard_Real aTol = 1e-6;
+
+  aFinder.SetShape(theShape);
+  aFinder.SetTolerance(aTol);
+  aFinder.SetSurface(theSurface);
+  aFinder.SetShapeType(theShapeType);
+  aFinder.SetState(theState);
+
+  // Sets the minimal number of inner points for the faces that do not have own
+  // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
+  // Default value=3
+  aFinder.SetNbPntsMin(3);
+  // Sets the maximal number of inner points for edges or faces.
+  // It is usefull for the cases when this number is very big (e.g =2000) to improve
+  // the performance. If this value =0, all inner points will be taken into account.
+  // Default value=0
+  aFinder.SetNbPntsMax(0);
+
+  aFinder.Perform();
+
+  // Interprete results
+  Standard_Integer iErr = aFinder.ErrorStatus();
+  // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+  if (iErr) {
+//    MESSAGE(" iErr : " << iErr);
+    TCollection_AsciiString aMsg (" iErr : ");
+    aMsg += TCollection_AsciiString(iErr);
+    StdFail_NotDone::Raise(aMsg.ToCString());
+    return aSeqOfIDs;
+  }
+//  Standard_Integer iWrn = aFinder.WarningStatus();
+  // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+//  if (iWrn) {
+//    MESSAGE(" *** iWrn : " << iWrn);
+//  }
+
+  const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
+
+  if (listSS.Extent() < 1) {
+    //StdFail_NotDone::Raise("Not a single sub-shape of the requested type found on the given surface");
+    StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
+    return aSeqOfIDs;
+  }
+
+  // Fill sequence of object IDs
+  aSeqOfIDs = new TColStd_HSequenceOfInteger;
+
+  TopTools_IndexedMapOfShape anIndices;
+  TopExp::MapShapes(theShape, anIndices);
+
+  TopTools_ListIteratorOfListOfShape itSub (listSS);
+  for (int index = 1; itSub.More(); itSub.Next(), ++index) {
+    int id = anIndices.FindIndex(itSub.Value());
+    aSeqOfIDs->Append(id);
+  }
+
+  return aSeqOfIDs;
+}
+
+//=======================================================================
+//function : GetCommonShapesOnCylinders
+//purpose  : return the common shapes between 2 cylindrical surfaces
+//           along OX and OZ
+//=======================================================================
+void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
+                                                      TopAbs_ShapeEnum theShapeType,
+                                                      double r1, 
+                                                      double r2,
+                                                      Handle(TopTools_HSequenceOfShape)& commonShapes) const
+{
+  gp_Pnt aP0 (0, 0, 0);
+  gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
+  gp_Ax3 anAxis1 (aP0, aVX), anAxis2 (aP0, aVZ);
+
+  TopTools_IndexedMapOfShape aMapOfShapes;
+  aMapOfShapes.Clear();
+  TopExp::MapShapes(theShape, aMapOfShapes);
+  
+  commonShapes->Clear();
+
+  int myID;
+  bool found = false;
+
+  // Create a cylinder surface
+  Handle(Geom_Surface) aC1Ext = new Geom_CylindricalSurface(anAxis1, r1);
+  if ( aC1Ext.IsNull() )
+    StdFail_NotDone::Raise("Couldn't build main cylindrical surface");
+  // Find object IDs
+  Handle(TColStd_HSequenceOfInteger) aSeqExt1 = GetShapesOnSurfaceIDs( aC1Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
+  // Create a cylinder surface
+  Handle(Geom_Surface) aC2Ext = new Geom_CylindricalSurface(anAxis2, r2);
+  if ( aC2Ext.IsNull() )
+    StdFail_NotDone::Raise("Couldn't build incident cylindrical surface");
+  // Find object IDs
+  Handle(TColStd_HSequenceOfInteger) aSeqExt2 = GetShapesOnSurfaceIDs( aC2Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
+  // # Recherche (dans le quart de Te) de l'arete d'intersection des 2 cylindres
+  // # Search in theShape for common shape of type theShapeType on the intersection of 2 pipes
+  found = false;
+  for (int i=1; i<=aSeqExt2->Length();i++) {
+    std::cerr << "aSeqExt2->Value(i): " << aSeqExt2->Value(i) << std::endl;
+    for (int j=1; j<=aSeqExt1->Length();j++) {
+      std::cerr << "aSeqExt1->Value(j): " << aSeqExt1->Value(j) << std::endl;
+      if (aSeqExt1->Value(j) == aSeqExt2->Value(i)) {
+       myID = aSeqExt1->Value(j);
+       commonShapes->Append(aMapOfShapes.FindKey(myID));
+       found = true;
+      }
+    }
+  }
+  if (!found)
+    StdFail_NotDone::Raise("Common shapes couldn't be found");
+}
+
+//=======================================================================
+//function : MakePipeTShape
+//purpose  :
+//=======================================================================
+TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape(const double r1, const double w1, const double l1,
+                                                      const double r2, const double w2, const double l2) const
+{
+  double r1Ext = r1 + w1;
+  double r2Ext = r2 + w2;
+
+  gp_Pnt aP0 (0, 0, 0);
+  gp_Pnt aP1 (-l1, 0, 0);
+  gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
+  gp_Ax2 anAxes1 (aP1, aVX);
+  gp_Ax2 anAxes2 (aP0, aVZ);
+
+  // Build the initial pipes
+  BRepPrimAPI_MakeCylinder C1Int (anAxes1, r1, Abs(2 * l1));
+  BRepPrimAPI_MakeCylinder C1Ext (anAxes1, r1Ext, Abs(2 * l1));
+  BRepPrimAPI_MakeCylinder C2Int (anAxes2, r2, Abs(l2));
+  BRepPrimAPI_MakeCylinder C2Ext (anAxes2, r2Ext, Abs(l2));
+  C1Int.Build();
+  C1Ext.Build();
+  C2Int.Build();
+  C2Ext.Build();
+  if (!C1Int.IsDone() || !C1Ext.IsDone() || !C2Int.IsDone() || !C2Ext.IsDone()) {
+    StdFail_NotDone::Raise("Couldn't build cylinders");
+  }
+
+  // Fuse the 2 pipes
+  BRepAlgoAPI_Fuse fuse1 (C1Ext.Shape(), C2Ext.Shape());
+  if (!fuse1.IsDone()) {
+    StdFail_NotDone::Raise("Couldn't fuse cylinders");
+  }
+
+  // Remove small radius main pipe
+  BRepAlgoAPI_Cut cut1 (fuse1.Shape(), C1Int.Shape());
+  if (!cut1.IsDone()) {
+    StdFail_NotDone::Raise("Coudn't cut cylinders");
+  }
+
+  // Remove small radius incident pipe => Te
+  BRepAlgoAPI_Cut Te (cut1.Shape(), C2Int.Shape());
+  if (!Te.IsDone()) {
+    StdFail_NotDone::Raise("Coudn't cut cylinders");
+  }
+
+  return Te.Shape();
+}
+
+//=======================================================================
+//function : MakeQuarterPipeTShape
+//purpose  :
+//=======================================================================
+TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakeQuarterPipeTShape(const double r1, const double w1, const double l1,
+                                                     const double r2, const double w2, const double l2) const
+{
+  double r1Ext = r1 + w1;
+  TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2);
+  if (Te.IsNull())
+    StdFail_NotDone::Raise("Couldn't build Pipe TShape");
+
+  // Get a quarter of shape => Te2
+  BRepPrimAPI_MakeBox box1 (gp_Pnt(0,-2*r1Ext,-2*r1Ext),gp_Pnt(Abs(2 * l1), 2*r1Ext, Abs(2*l2)));
+  BRepPrimAPI_MakeBox box2 (gp_Pnt(0,2*r1Ext,-2*r1Ext),gp_Pnt(-Abs(2 * l1), 0, Abs(2*l2)));
+  box1.Build();
+  box2.Build();
+  if (!box1.IsDone() || !box2.IsDone()) {
+    StdFail_NotDone::Raise("Couldn't build boxes");
+  }
+  BRepAlgoAPI_Cut cut3 (Te, box1.Shape());
+  if (!cut3.IsDone()) {
+    StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
+  }
+  BRepAlgoAPI_Cut Te4 (cut3.Shape(), box2.Shape());
+  if (!Te4.IsDone()) {
+    StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
+  }
+
+  return Te4.Shape();
+}
+
+//=======================================================================
+//function : Execute
+//purpose  :
+//=======================================================================
+Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) const
+{
+  if (Label().IsNull()) return 0;
+  Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+
+  GEOMImpl_IPipeTShape aData (aFunction);
+  Standard_Integer aType = aFunction->GetType();
+
+  TopoDS_Shape aShape, Te4, Te4Part;
+//   TopoDS_Edge arete_intersect_int;
+//   Handle(TopTools_HSequenceOfShape) edges_e = new TopTools_HSequenceOfShape;
+  Handle(TColStd_HSequenceOfInteger) edges_e;
+//   Handle(TopTools_HSequenceOfShape) edges_i = new TopTools_HSequenceOfShape;
+//   gp_Pnt aP0 (0, 0, 0);
+//   gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
+  bool hexMesh = (bool) aData.GetHexMesh();
+
+  // Useful values
+//   double aSize = 2*(aData.GetL1() + aData.GetL2());
+  double epsilon = Precision::Approximation();
+  double aR1Ext = aData.GetR1() + aData.GetW1();
+  double aR2Ext = aData.GetR2() + aData.GetW2();
+  
+  if (aData.GetR2() > aData.GetR1() + epsilon) {
+    std::cerr << "aData.GetR1(): " << aData.GetR1() << std::endl;
+    std::cerr << "aData.GetR2(): " << aData.GetR2() << std::endl;
+    StdFail_NotDone::Raise("TShape cannot be computed if R2 > R1");
+  }
+
+  if (aR2Ext > aR1Ext + epsilon) {
+    std::cerr << "aR1Ext: " << aR1Ext << std::endl;
+    std::cerr << "aR2Ext: " << aR2Ext << std::endl;
+    StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 > R1+W1");
+  }
+  
+  // external radius are equal
+  if (fabs(aR2Ext - aR1Ext) < epsilon) {
+    if (aType == TSHAPE_CHAMFER)
+      StdFail_NotDone::Raise("TShape with chamfer cannot be computed if R2+W2 = R1+W1");
+    if (aType == TSHAPE_FILLET)
+      StdFail_NotDone::Raise("TShape with fillet cannot be computed if R2+W2 = R1+W1");
+    // internal radius are different => not possible
+    if (fabs(aData.GetR2() - aData.GetR1()) > epsilon) {
+      std::cerr << "R1Ext: " << aR1Ext << std::endl;
+      std::cerr << "R2Ext: " << aR2Ext << std::endl;
+      std::cerr << "R1: " << aData.GetR1() << std::endl;
+      std::cerr << "R2: " << aData.GetR2() << std::endl;
+      StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 = R1+W1 and R2 != R1");
+    }
+  }
+
+
+  if (aR1Ext >= aData.GetL2() + epsilon) {
+    StdFail_NotDone::Raise("TShape cannot be computed if R1+W1 >= L2");
+  }
+  if (aR2Ext >=  aData.GetL1() + epsilon) {
+    StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 >= L1");
+  }
+
+  if (aType == TSHAPE_CHAMFER) {
+    if (aData.GetH() >= (aData.GetL2() - aR1Ext + epsilon)) {
+      std::cerr << "H: " << aData.GetH() << std::endl;
+      std::cerr << "L2: " << aData.GetL2() << std::endl;
+      std::cerr << "R1Ext: " << aR1Ext << std::endl;
+      std::cerr << "aData.GetL2() - aR1Ext: " << aData.GetL2() - aR1Ext << std::endl;
+      StdFail_NotDone::Raise("TShape cannot be computed: height of chamfer is too high");
+    }
+
+    if (aData.GetW() >= (aData.GetL1() - aR2Ext + epsilon))
+      StdFail_NotDone::Raise("TShape cannot be computed: width of chamfer is too high");
+  }
+
+  if (aType == TSHAPE_FILLET) {
+    if (aData.GetRF() >= (aData.GetL2() - aR1Ext + epsilon) || 
+      aData.GetRF() >= (aData.GetL1() - aR2Ext + epsilon))
+      StdFail_NotDone::Raise("TShape cannot be computed: radius of fillet is too high");
+  }
+
+  if (hexMesh) {
+    // Create a quarter of a basic T-Shape pipe
+    std::cerr << "Create a quarter of a basic T-Shape pipe" << std::endl;
+    Te4 = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
+      aData.GetR2(), aData.GetW2(), aData.GetL2());
+  }
+  else {
+    // No need to cut pipe t-shape
+    std::cerr << "Create a basic T-Shape pipe" << std::endl;
+    Te4 = MakePipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
+      aData.GetR2(), aData.GetW2(), aData.GetL2());
+  }
+  aShape = Te4;
+/*
+  if (aType == TSHAPE_BASIC) {
+      aShape = Te4;
+//       aShape = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
+//       aData.GetR2(), aData.GetW2(), aData.GetL2());
+  }
+  else if (aType == TSHAPE_CHAMFER) {
+    // TShape with chamfer
+//     BRep_Builder BB;
+//     TopoDS_Compound CC;
+//     BB.MakeCompound(CC);
+    // Create chamfer on the edges edges_e
+    BRepFilletAPI_MakeChamfer chamfer (Te4);
+    TopTools_IndexedMapOfShape anEdgesIndices;
+    TopExp::MapShapes(Te4, anEdgesIndices);
+
+    TopoDS_Shape theBox;
+    if (hexMesh) {
+      BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+      aBox.Build();
+      if (!aBox.IsDone()) {
+        StdFail_NotDone::Raise("Couldn't build box");
+      }
+      theBox = aBox.Shape();
+    }
+    else {
+      BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+      aBox.Build();
+      if (!aBox.IsDone()) {
+        StdFail_NotDone::Raise("Couldn't build box");
+      }
+      theBox = aBox.Shape();
+    }
+    Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
+    edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
+    if (edges_e.IsNull() || edges_e->Length() == 0) {
+      StdFail_NotDone::Raise("Common edges not found");
+    }
+  
+
+    TopTools_IndexedDataMapOfShapeListOfShape M;
+    GEOMImpl_Block6Explorer::MapShapesAndAncestors(Te4, TopAbs_EDGE, TopAbs_FACE, M);
+//     std::cerr << "Number of IDs: " << edges_e->Length() << std::endl;
+    int nbEdgesInChamfer = 0;
+    for (int i=1;i<=edges_e->Length();i++) {
+//       std::cerr << "Get Edge with ID #" << i << std::endl;
+      int theId = edges_e->Value(i);
+//       std::cerr << "ID #" << i << "= " << theId << std::endl;
+//       std::cerr << "Search for edge in shape" << std::endl;
+      TopoDS_Edge theEdge = TopoDS::Edge(anEdgesIndices.FindKey(theId));
+//       std::cerr << "Found" << std::endl;
+//       std::cerr << "Keep only edges with a vertex on (x, x, re1)" << std::endl;
+      TopExp_Explorer ExVertices;
+      for (ExVertices.Init(theEdge,TopAbs_VERTEX); ExVertices.More(); ExVertices.Next()) {
+        gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(ExVertices.Current()));
+        if (aPt.Z() - aR1Ext <= epsilon) {
+//           std::cerr << "aPt.Z() = aR1Ext => keep this edge" << std::endl;
+          nbEdgesInChamfer ++;
+          const TopTools_ListOfShape& aFL = M.FindFromKey(theEdge);
+          TopoDS_Face F = TopoDS::Face( aFL.First() );
+          if (hexMesh)
+            chamfer.Add(aData.GetH(), aData.GetW(), theEdge, F);
+          else
+            chamfer.Add(aData.GetW(), aData.GetH(), theEdge, F);
+          break;
+        }
+      }
+//       std::cerr << "Test if hexMesh: ";
+      if (hexMesh && nbEdgesInChamfer == 1) {
+//         std::cerr << "Yes => stop after 1 edge" << std::endl;
+        break;
+      }
+//       std::cerr << "No => continue for other edges" << std::endl;
+  //  BB.Add(CC, edges_e->Value(i));
+  //  const TopTools_ListOfShape& aFL = M.FindFromKey(TopoDS::Edge(edges_e->Value(i)));
+  //  chamfer.Add(aData.GetW(), aData.GetH(), TopoDS::Edge(edges_e->Value(i)), F);
+    }
+//     std::cerr << "Build chamfer with " << nbEdgesInChamfer << " edges" << std::endl;
+//     }
+    chamfer.Build();
+    if (!chamfer.IsDone()) {
+      StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters");
+    }
+    
+//     BB.Add(CC, chamfer.Shape());
+    
+    
+//     aShape = CC;
+    aShape = chamfer.Shape();
+  }
+  else if (aType == TSHAPE_FILLET) {
+    // TShape with fillet
+    // Create fillet on the edge arete_intersect_ext
+    BRepFilletAPI_MakeFillet fill (Te4);
+    
+    TopTools_IndexedMapOfShape anIndices;
+    TopExp::MapShapes(Te4, anIndices);
+    
+    TopoDS_Shape theBox;
+    if (hexMesh) {
+      BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+      aBox.Build();
+      if (!aBox.IsDone()) {
+        StdFail_NotDone::Raise("Couldn't build box");
+      }
+      theBox = aBox.Shape();
+    }
+    else {
+      BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+      aBox.Build();
+      if (!aBox.IsDone()) {
+        StdFail_NotDone::Raise("Couldn't build box");
+      }
+      theBox = aBox.Shape();
+    }
+    Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
+    edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
+    if (edges_e.IsNull() || edges_e->Length() == 0) {
+      StdFail_NotDone::Raise("Common edges not found");
+    }
+    
+//     fill.Add(TopoDS::Edge(edges_e->Value(1)));
+//     if (!hexMesh) {
+    for (int i=1;i<=edges_e->Length();i++) {
+      if (hexMesh && (i > 1))
+        break;
+      TopoDS_Edge theEdge = TopoDS::Edge(anIndices.FindKey(edges_e->Value(i)));
+      fill.Add(theEdge);
+//             fill.Add(TopoDS::Edge(edges_e->Value(i)));
+    }
+//     }
+    fill.SetRadius(aData.GetRF(), 1, 1);
+    fill.Build();
+    if (!fill.IsDone()) {
+      StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
+    }
+
+    aShape = fill.Shape();
+  }
+  else {
+    // other construction modes here
+  }
+*/
+  if (aShape.IsNull()) return 0;
+
+  aFunction->SetValue(aShape);
+
+  log.SetTouched(Label());
+
+  return 1;
+}
+
+//=======================================================================
+//function :  GEOMImpl_PipeTShapeDriver_Type_
+//purpose  :
+//=======================================================================
+Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_()
+{
+  static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
+  if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
+  static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+  if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+  static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+  if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+  static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+  static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipeTShapeDriver",
+                                                         sizeof(GEOMImpl_PipeTShapeDriver),
+                                                         1,
+                                                         (Standard_Address)_Ancestors,
+                                                         (Standard_Address)NULL);
+  return _aType;
+}
+
+//=======================================================================
+//function : DownCast
+//purpose  :
+//=======================================================================
+const Handle(GEOMImpl_PipeTShapeDriver) Handle(GEOMImpl_PipeTShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
+{
+  Handle(GEOMImpl_PipeTShapeDriver) _anOtherObject;
+
+  if (!AnObject.IsNull()) {
+     if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipeTShapeDriver))) {
+       _anOtherObject = Handle(GEOMImpl_PipeTShapeDriver)((Handle(GEOMImpl_PipeTShapeDriver)&)AnObject);
+     }
+  }
+
+  return _anOtherObject;
+}
diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx
new file mode 100644 (file)
index 0000000..9aaecb3
--- /dev/null
@@ -0,0 +1,198 @@
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  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
+
+#ifndef _GEOMImpl_PipeTShapeDriver_HXX
+#define _GEOMImpl_PipeTShapeDriver_HXX
+
+#include <TFunction_Driver.hxx>
+
+#include "GEOMAlgo_State.hxx"
+
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#include <Handle_Geom_Surface.hxx>
+
+class Handle_Standard_Type;
+class GEOMImpl_PipeTShapeDriver;
+
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
+
+class Handle(GEOMImpl_PipeTShapeDriver) : public Handle(TFunction_Driver) {
+public:
+  inline void* operator new(size_t,void* anAddress) 
+  {
+    return anAddress;
+  }
+  inline void* operator new(size_t size) 
+  { 
+    return Standard::Allocate(size); 
+  }
+  inline void  operator delete(void *anAddress) 
+  { 
+    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+  }
+  
+  Handle(GEOMImpl_PipeTShapeDriver)():Handle(TFunction_Driver)() {} 
+  Handle(GEOMImpl_PipeTShapeDriver)(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) 
+  {}
+
+  Handle(GEOMImpl_PipeTShapeDriver)(const GEOMImpl_PipeTShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) 
+  {}
+
+  Handle(GEOMImpl_PipeTShapeDriver)& operator=(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle)
+  {
+    Assign(aHandle.Access());
+    return *this;
+  }
+  
+  Handle(GEOMImpl_PipeTShapeDriver)& operator=(const GEOMImpl_PipeTShapeDriver* anItem)
+  {
+    Assign((Standard_Transient *)anItem);
+    return *this;
+  }
+  
+  GEOMImpl_PipeTShapeDriver* operator->() 
+  {
+    return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
+  }
+  
+  GEOMImpl_PipeTShapeDriver* operator->() const 
+  {
+    return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
+  }
+  
+  Standard_EXPORT ~Handle(GEOMImpl_PipeTShapeDriver)() {};
+  
+  Standard_EXPORT static const Handle(GEOMImpl_PipeTShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+
+class GEOMImpl_PipeTShapeDriver : public TFunction_Driver {
+public:
+  inline void* operator new(size_t,void* anAddress) 
+  {
+    return anAddress;
+  }
+  inline void* operator new(size_t size) 
+  { 
+    return Standard::Allocate(size); 
+  }
+  inline void  operator delete(void *anAddress) 
+  { 
+    if (anAddress) Standard::Free((Standard_Address&)anAddress); 
+  }
+  
+  // Methods PUBLIC
+  // 
+  Standard_EXPORT GEOMImpl_PipeTShapeDriver();
+  Standard_EXPORT virtual  Standard_Integer Execute(TFunction_Logbook& log) const; 
+  Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
+  Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
+  {
+    return Standard_True;
+  }
+  Standard_EXPORT static const Standard_GUID& GetID();
+  Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {};
+  
+  // Type management
+  //
+  Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_();
+  Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
+  {
+    return STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
+  }
+  Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
+  {
+    return (STANDARD_TYPE(GEOMImpl_PipeTShapeDriver) == AType || TFunction_Driver::IsKind(AType));
+  }
+private:
+  /*!
+   * \brief Create a T-Shape based on pipes
+   * \param r1 - the internal radius of main pipe
+   * \param w1 - the thickness main pipe
+   * \param l1 - the half-length of main pipe
+   * \param r2 - the internal radius of incident pipe
+   * \param w2 - the thickness incident pipe
+   * \param l2 - the half-length of main pipe
+   * \retval TopoDS_Shape - Resulting shape
+   */
+  TopoDS_Shape MakePipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
+
+  /*!
+   * \brief Create a quarter of a T-Shape based on pipes
+   * \param r1 - the internal radius of main pipe
+   * \param w1 - the thickness main pipe
+   * \param l1 - the half-length of main pipe
+   * \param r2 - the internal radius of incident pipe
+   * \param w2 - the thickness incident pipe
+   * \param l2 - the half-length of main pipe
+   * \retval TopoDS_Shape - Resulting shape
+   */
+  TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
+
+//=======================================================================
+//function : GetShapesOnSurfaceIDs
+  /*!
+   * \brief Find IDs of subshapes complying with given status about surface
+   * \param theSurface - the surface to check state of subshapes against
+   * \param theShape - the shape to explore
+   * \param theShapeType - type of subshape of theShape
+   * \param theState - required state
+   * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+   */
+  Handle(TColStd_HSequenceOfInteger)
+    GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
+                          const TopoDS_Shape&         theShape,
+                          TopAbs_ShapeEnum            theShapeType,
+                          GEOMAlgo_State              theState) const;
+//=======================================================================
+//function : getShapesOnBoxIDs
+  /*!
+   * \brief Find IDs of subshapes complying with given status about surface
+    * \param theBox - the box to check state of subshapes against
+    * \param theShape - the shape to explore
+    * \param theShapeType - type of subshape of theShape
+    * \param theState - required state
+    * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
+   */
+//=======================================================================
+  Handle(TColStd_HSequenceOfInteger)
+  GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
+                 const TopoDS_Shape& aShape,
+                 const Standard_Integer theShapeType,
+                 GEOMAlgo_State theState) const;
+
+  //=======================================================================
+  //function : getCommonShapesOnCylinders
+  //purpose  : return the common edge between 2 cylindrical surfaces
+  //           along OX and OZ
+  //=======================================================================
+  void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
+                                 TopAbs_ShapeEnum theShapeType,
+                  double r, double r2,
+                                 Handle(TopTools_HSequenceOfShape)& commonShapes) const;
+
+};
+
+#endif // _GEOMImpl_PipeTShapeDriver_HXX
index 734e5dd3b5377acebc1126dcdf2b54b1d1941060..c20d394db59e23bc57588c83c835be0ae293c2e8 100755 (executable)
 
 // Advanced functions (base = 200)
 #define ADVANCED_BASE 200  // NO OPERATION (advanced operations base)
-/*@@ insert new functions before this line @@*/
-
+#define GEOM_TSHAPE 201
 // Advanced functions sub-operations codes
+#define TSHAPE_BASIC 1
+#define TSHAPE_CHAMFER 2
+#define TSHAPE_FILLET 3
 /*@@ insert new functions before this line @@*/
index 0c03153c7bf6dae6bcdcea7bd9f88ca8a4bb68d3..dbcc35cb5446f21bce4b737070dafb3f1efa3039 100755 (executable)
@@ -68,3 +68,5 @@ FF1BBB67-5D14-4df2-980B-3A668264EA16 // Blocks
 FF1BBB68-5D14-4df2-980B-3A668264EA16 // Sub shape GUID
 
 FF1BBB69-5D14-4df2-980B-3A668264EA16 // Modify the Location
+
+1C3A0F3F-729D-4E83-8232-78E74FC5637C // Pipe T-Shape
index 2774521b1bb9dddf3032750b5ef91ddd35fd80a4..92f41abd5d5dd45e82628d3f05a7cec9d36e3a25 100644 (file)
@@ -147,6 +147,7 @@ salomeinclude_HEADERS =                             \
        GEOM_GEOMImpl.hxx
 
 ADVANCED_INCLUDES  =
+ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
 ##@@ insert new functions before this line @@##
 
 salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
@@ -215,6 +216,7 @@ dist_libGEOMimpl_la_SOURCES =                       \
        GEOMImpl_GlueDriver.cxx
 
 ADVANCED_SOURCES  =
+ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
 ##@@ insert new functions before this line @@##
 
 dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)
index fa6fe5b798161c4c796d7743965673abdd67244c..cf52cfa0bf2afcbf3b6a0283aee408b6638102e9 100644 (file)
@@ -55,4 +55,255 @@ GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i()
   MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i");
 }
 
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length).
+ *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theHexMesh false = no partition, true = with partition
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                                             CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh)
+{
+  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Create the TShape
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
+  
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length).
+ *  The T-shape is placed at junction points P1, P2 and P3.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theHexMesh false = no partition, true = with partition
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                                                             CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh,
+                                                                             GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference vertices
+  Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+  Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+  Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+  if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
+
+  //Create the TShape
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3);
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
+  
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length). A chamfer is created on
+ *  the junction of the pipes.
+ *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theH Height of the chamfer.
+ *  \param theW Width of the chamfer.
+ *  \param theHexMesh false = no partition, true = with partition
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                                                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
+                                                                       CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
+{
+  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Create the TShape
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
+  
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length). A chamfer is created on
+ *  the junction of the pipes.
+ *  The T-shape is placed at junction points P1, P2 and P3.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theH Height of the chamfer.
+ *  \param theW Width of the chamfer.
+ *  \param theHexMesh false = no partition, true = with partition
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                                                                    CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
+                                                                                    CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
+                                                                                    GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference vertices
+  Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+  Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+  Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+
+  //Create the TShape
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
+                                                                                   theHexMesh, aP1, aP2, aP3);
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
+  
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length). A fillet is created on
+ *  the junction of the pipes.
+ *  Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theRF Radius of curvature of fillet.
+ *  \param theHexMesh false = no partition, true = with partition
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+                                                                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
+                                                                       CORBA::Double theRF, CORBA::Boolean theHexMesh)
+{
+  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Create the TShape
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
+  
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ *  Create a T-shape object with specified caracteristics for the main and the
+ *  incident pipes (radius, width, half-length). A fillet is created on
+ *  the junction of the pipes.
+ *  The T-shape is placed at junction points P1, P2 and P3.
+ *  \param theR1 Internal radius of main pipe
+ *  \param theW1 Width of main pipe
+ *  \param theL1 Half-length of main pipe
+ *  \param theR2 Internal radius of incident pipe (R2 < R1)
+ *  \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ *  \param theL2 Half-length of incident pipe
+ *  \param theRF Radius of curvature of fillet.
+ *  \param theHexMesh false = no partition, true = with partition
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+                                                                                   CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
+                                                                                   CORBA::Double theRF, CORBA::Boolean theHexMesh,
+                                                                                   GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference vertices
+  Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+  Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+  Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+
+  //Create the TShape
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, 
+                                                                                  theHexMesh, aP1, aP2, aP3);
+  if (!GetOperations()->IsDone() || aHSeq.IsNull())
+    return aSeq._retn();
+  
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq->length(aLength);
+  for (Standard_Integer i = 1; i <= aLength; i++)
+    aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+  return aSeq._retn();
+}
+
 /*@@ insert new functions before this line @@*/
index a40f62e8ad2ec9da51db6d1e366598d280f8d38f..eaa1baa967fa807194d798969144c4a52be7ce9b 100644 (file)
@@ -45,6 +45,27 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i :
                            ::GEOMImpl_IAdvancedOperations* theImpl);
   ~GEOM_IAdvancedOperations_i();
 
+  GEOM::ListOfGO* MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                 CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+                                 CORBA::Boolean theHexMesh);
+  GEOM::ListOfGO* MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                             CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+                                             CORBA::Boolean theHexMesh,
+                                             GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+  GEOM::ListOfGO* MakePipeTShapeChamfer (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                        CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+                                        CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh);
+  GEOM::ListOfGO* MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                                    CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+                                                    CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
+                                                    GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+  GEOM::ListOfGO* MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                       CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
+                                       CORBA::Double theRF, CORBA::Boolean theHexMesh);
+  GEOM::ListOfGO* MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, 
+                                                   CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, 
+                                                   CORBA::Double theRF, CORBA::Boolean theHexMesh,
+                                                   GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
   /*@@ insert new functions before this line @@*/
 
   ::GEOMImpl_IAdvancedOperations* GetOperations()
index 88c5cc42fd4999a4a1f78730534e6731254c1676..cda11a10f89b27730eec12d1de57daad97f8cf63 100644 (file)
@@ -4134,6 +4134,92 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         ## @addtogroup l4_advanced 
         ## @{
 
+        ## Create a T-shape object with specified caracteristics for the main
+        #  and the incident pipes (radius, width, half-length).
+        #  Center of the shape is (0,0,0). The main plane of the T-shape is
+        #  XOY.
+        #  @param theR1 Internal radius of main pipe
+        #  @param theW1 Width of main pipe
+        #  @param theL1 Half-length of main pipe
+        #  @param theR2 Internal radius of incident pipe (R2 < R1)
+        #  @param theW2 Width of incident pipe (R2+W2 < R1+W1)
+        #  @param theL2 Half-length of incident pipe
+        #  @param theHexMesh false = no partition, true = with partition (default=true)
+        #  @param theP1 1st junction point of main pipe
+        #  @param theP2 2nd junction point of main pipe
+        #  @param theP3 Junction point of incident pipe
+        #  @return List of GEOM_Objects, containing the created shape and propagation groups.
+        #
+        #  @ref tui_creation_tshape "Example"
+        def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+            theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
+           if (theP1 and theP2 and theP3):
+             anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
+           else:
+             anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
+           RaiseIfFailed("MakePipeTShape", self.AdvOp)
+            if Parameters: anObj[0].SetParameters(Parameters)
+            return anObj
+
+       ## Create a T-shape object with specified caracteristics for the main
+        #  and the incident pipes (radius, width, half-length). A chamfer is
+       #  created on the junction of the pipes.
+        #  Center of the shape is (0,0,0). The main plane of the T-shape is
+        #  XOY.
+        #  @param theR1 Internal radius of main pipe
+        #  @param theW1 Width of main pipe
+        #  @param theL1 Half-length of main pipe
+        #  @param theR2 Internal radius of incident pipe (R2 < R1)
+        #  @param theW2 Width of incident pipe (R2+W2 < R1+W1)
+        #  @param theL2 Half-length of incident pipe
+        #  @param theH Height of the chamfer.
+        #  @param theW Width of the chamfer.
+       #  @param theHexMesh false = no partition, true = with partition (default=true)
+        #  @param theP1 1st junction point of main pipe
+        #  @param theP2 2nd junction point of main pipe
+        #  @param theP3 Junction point of incident pipe
+        #  @return List of GEOM_Objects, containing the created shape and propagation groups.
+        #
+        #  @ref tui_creation_tshape "Example"
+        def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+            theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW)
+           if (theP1 and theP2 and theP3):
+             anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3)
+           else:
+             anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
+            RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
+            if Parameters: anObj[0].SetParameters(Parameters)
+            return anObj
+
+       ## Create a T-shape object with specified caracteristics for the main
+        #  and the incident pipes (radius, width, half-length). A fillet is
+       #  created on the junction of the pipes.
+        #  Center of the shape is (0,0,0). The main plane of the T-shape is
+        #  XOY.
+        #  @param theR1 Internal radius of main pipe
+        #  @param theW1 Width of main pipe
+        #  @param theL1 Half-length of main pipe
+        #  @param theR2 Internal radius of incident pipe (R2 < R1)
+        #  @param theW2 Width of incident pipe (R2+W2 < R1+W1)
+        #  @param theL2 Half-length of incident pipe
+        #  @param theRF Radius of curvature of fillet.
+       #  @param theHexMesh false = no partition, true = with partition (default=true)
+        #  @param theP1 1st junction point of main pipe
+        #  @param theP2 2nd junction point of main pipe
+        #  @param theP3 Junction point of incident pipe
+        #  @return List of GEOM_Objects, containing the created shape and propagation groups.
+        #
+        #  @ref tui_creation_tshape "Example"
+        def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+            theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
+           if (theP1 and theP2 and theP3):
+             anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3)
+           else:
+             anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
+            RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
+            if Parameters: anObj[0].SetParameters(Parameters)
+            return anObj
+
         #@@ insert new functions before this line @@#
 
         # end of l4_advanced