From: vsr Date: Fri, 15 Mar 2013 14:28:11 +0000 (+0000) Subject: Merge from V6_main 15/03/2013 X-Git-Tag: V7_1_0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ab178242861f911fded8a5e8f16b209682f30a1;p=modules%2Fgeom.git Merge from V6_main 15/03/2013 --- diff --git a/doc/salome/examples/advanced_geom_objs_ex01.py b/doc/salome/examples/advanced_geom_objs_ex01.py index eb3db5fe5..036fe8f4e 100644 --- a/doc/salome/examples/advanced_geom_objs_ex01.py +++ b/doc/salome/examples/advanced_geom_objs_ex01.py @@ -27,6 +27,16 @@ id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_po for g in pipetshape_position[1:]: geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName()) +# create PipeTShape object with left thickness reduction +pipetshape_thr = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, + theRL=60, theWL=20, theLtransL=40, theLthinL=20) + +# add object in the study +id_pipetshape_thr = geompy.addToStudy(pipetshape_thr[0],"PipeTShape_left_thickness_reduction") +# add groups in the study +for g in pipetshape_thr[1:]: + geompy.addToStudyInFather(pipetshape_thr[0], g, g.GetName()) + # create PipeTShape with chamfer object pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0) @@ -45,6 +55,17 @@ id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0], for g in pipetshapechamfer_position[1:]: geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName()) +# create PipeTShape with chamfer object with left and right thickness reductions +pipetshapechamfer_thr = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, + theRL=60, theWL=20, theLtransL=40, theLthinL=20, + theRR=40, theWR=10, theLtransR=60, theLthinR=30) + +# add object in the study +id_pipetshapechamfer_thr = geompy.addToStudy(pipetshapechamfer_thr[0],"PipeTShapeChamfer_two_thickness_reductions") +# add groups in the study +for g in pipetshapechamfer_thr[1:]: + geompy.addToStudyInFather(pipetshapechamfer_thr[0], g, g.GetName()) + # create PipeTShape with fillet object pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0) @@ -62,12 +83,28 @@ id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"P # add groups in the study for g in pipetshapefillet_position[1:]: geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName()) - + +# create PipeTShape with fillet object with three thickness reductions +pipetshapefillet_thr = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, + 5.0, True, None, None, None, + 60, 20, 40, 20, + 40, 10, 60, 30, + 20, 10, 30, 30) + +# add object in the study +id_pipetshapefillet_thr = geompy.addToStudy(pipetshapefillet_thr[0],"PipeTShapeFillet_three_thickness_reductions") +# add groups in the study +for g in pipetshapefillet_thr[1:]: + geompy.addToStudyInFather(pipetshapefillet_thr[0], g, g.GetName()) + # display pipetshapes gg.createAndDisplayGO(id_pipetshape) gg.createAndDisplayGO(id_pipetshape_position) +gg.createAndDisplayGO(id_pipetshape_thr) gg.createAndDisplayGO(id_pipetshapechamfer) gg.createAndDisplayGO(id_pipetshapechamfer_position) +gg.createAndDisplayGO(id_pipetshapechamfer_thr) gg.createAndDisplayGO(id_pipetshapefillet) gg.createAndDisplayGO(id_pipetshapefillet_position) +gg.createAndDisplayGO(id_pipetshapefillet_thr) diff --git a/doc/salome/gui/GEOM/images/pipetshape_dlg.png b/doc/salome/gui/GEOM/images/pipetshape_dlg.png index c59e012e5..54d9abdc5 100644 Binary files a/doc/salome/gui/GEOM/images/pipetshape_dlg.png and b/doc/salome/gui/GEOM/images/pipetshape_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshape_pos_dlg.png b/doc/salome/gui/GEOM/images/pipetshape_pos_dlg.png new file mode 100644 index 000000000..243fe8cb0 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshape_pos_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshape_thr_dlg.png b/doc/salome/gui/GEOM/images/pipetshape_thr_dlg.png new file mode 100644 index 000000000..618a167db Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshape_thr_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshapethr.png b/doc/salome/gui/GEOM/images/pipetshapethr.png new file mode 100644 index 000000000..119e7331e Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshapethr.png differ diff --git a/doc/salome/gui/GEOM/input/creating_pipetshape.doc b/doc/salome/gui/GEOM/input/creating_pipetshape.doc index b7f448ed9..44124f52e 100644 --- a/doc/salome/gui/GEOM/input/creating_pipetshape.doc +++ b/doc/salome/gui/GEOM/input/creating_pipetshape.doc @@ -8,6 +8,16 @@ Specify the parameters of the PipeTShape object in the opened dialog box and press "Apply" or "Apply & Close" button. The result of the operation will be a GEOM_Object. +\n Main parameters: + +\image html pipetshape_dlg.png + +\n Position parameters: + +\image html pipetshape_pos_dlg.png + +\n Advanced options \ref preview_anchor "Preview" + TUI Command: geompy.MakePipeTShape(R1, W1, L1, R2, W2, L2, HexMesh=True, P1=None, P2=None, P3=None) Arguments: @@ -18,19 +28,17 @@ The result of the operation will be a GEOM_Object. - \b W2 - Thickness of the incident T-shape pipe. - \b L2 - Length of the incident T-shape pipe. - \b HexMesh - If True, the shape is splitted into blocks (suitable for hexaedral mesh). + +Position arguments: - \b P1 - First junction point of the main pipe (GEOM Vertex). - \b P2 - Second junction point of the main pipe (GEOM Vertex). - \b P3 - Junction point of the incident pipe (GEOM Vertex). -\n Advanced options \ref preview_anchor "Preview" - -\image html pipetshape_dlg.png - Example: \image html pipetshape.png -A Pipe T-Shape can be created with a chamfer at the junction of the main and the incident pipes: +

A Pipe T-Shape can be created with a chamfer at the junction of the main and the incident pipes:

TUI Command: geompy.MakePipeTShapeChamfer(R1, W1, L1, R2, W2, L2, H, W, HexMesh=True, P1=None, P2=None, P3=None) @@ -42,7 +50,7 @@ Example: \image html pipetshapechamfer.png -A Pipe T-Shape can be created with a fillet at the junction of the main and the incident pipes: +

A Pipe T-Shape can be created with a fillet at the junction of the main and the incident pipes:

TUI Command: geompy.MakePipeTShapeFillet(R1, W1, L1, R2, W2, L2, RF, HexMesh=True, P1=None, P2=None, P3=None) @@ -53,6 +61,35 @@ Example: \image html pipetshapefillet.png +

All three types of T-Shape (basic, with chamfer and with fillet) can +have thickness reductions at its open ends (two ends of the main pipe +and one end of the incident pipe):

+ +\image html pipetshape_thr_dlg.png + +TUI Commands: +\ngeompy.MakePipeTShape(R1, W1, L1, R2, W2, L2, HexMesh=True, P1=None, P2=None, P3=None, theRL=0, theWL=0, theLtransL=0, theLthinL=0, theRR=0, theWR=0, theLtransR=0, theLthinR=0, theRI=0, theWI=0, theLtransI=0, theLthinI=0) +\ngeompy.MakePipeTShapeChamfer(R1, W1, L1, R2, W2, L2, H, W, HexMesh=True, P1=None, P2=None, P3=None, theRL=0, theWL=0, theLtransL=0, theLthinL=0, theRR=0, theWR=0, theLtransR=0, theLthinR=0, theRI=0, theWI=0, theLtransI=0, theLthinI=0) +\ngeompy.MakePipeTShapeFillet(R1, W1, L1, R2, W2, L2, RF, HexMesh=True, P1=None, P2=None, P3=None, theRL=0, theWL=0, theLtransL=0, theLthinL=0, theRR=0, theWR=0, theLtransR=0, theLthinR=0, theRI=0, theWI=0, theLtransI=0, theLthinI=0) + +The additional arguments are: +- \b theRL - Internal radius of left thickness reduction. +- \b theWL - Width of left thickness reduction. +- \b theLtransL - Length of left transition part. +- \b theLthinL - Length of left thin part. +- \b theRR - Internal radius of right thickness reduction. +- \b theWR - Width of right thickness reduction. +- \b theLtransR - Length of right transition part. +- \b theLthinR - Length of right thin part. +- \b theRI - Internal radius of incident thickness reduction. +- \b theWI - Width of incident thickness reduction. +- \b theLtransI - Length of incident transition part. +- \b theLthinI - Length of incident thin part. + +Example: + +\image html pipetshapethr.png + Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_pipetshape "Advanced objects". diff --git a/doc/salome/gui/GEOM/static/header.html.in b/doc/salome/gui/GEOM/static/header.html.in index 4571b4363..d434d830d 100755 --- a/doc/salome/gui/GEOM/static/header.html.in +++ b/doc/salome/gui/GEOM/static/header.html.in @@ -5,6 +5,8 @@ $title + + $treeview $search $mathjax diff --git a/doc/salome/gui/GEOM/static/header_py.html.in b/doc/salome/gui/GEOM/static/header_py.html.in index 61414bb57..22abb143c 100644 --- a/doc/salome/gui/GEOM/static/header_py.html.in +++ b/doc/salome/gui/GEOM/static/header_py.html.in @@ -5,6 +5,8 @@ $title + + $treeview $search $mathjax diff --git a/doc/salome/tui/static/header.html.in b/doc/salome/tui/static/header.html.in index 4571b4363..d434d830d 100755 --- a/doc/salome/tui/static/header.html.in +++ b/doc/salome/tui/static/header.html.in @@ -5,6 +5,8 @@ $title + + $treeview $search $mathjax diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index d16392a9f..1e3a7c076 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -3935,6 +3935,8 @@ module GEOM */ interface GEOM_IAdvancedOperations : GEOM_IOperations { + // T-Shape WITHOUT Thickness reduction + /*! * \brief Create a T-shape object with specified caracteristics for the main and * the incident pipes (radius, width, half-length). @@ -4062,6 +4064,256 @@ module GEOM 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); + + // T-Shape WITH Thickness reduction + + /*! + * \brief 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 theRL Internal radius of left thickness reduction + * \param theWL Width of left thickness reduction + * \param theLtransL Length of left transition part + * \param theLthinL Length of left thin part + * + * \param theRR Internal radius of right thickness reduction + * \param theWR Width of right thickness reduction + * \param theLtransR Length of right transition part + * \param theLthinR Length of right thin part + * + * \param theRI Internal radius of incident thickness reduction + * \param theWI Width of incident thickness reduction + * \param theLtransI Length of incident transition part + * \param theLthinI Length of incident thin part + * + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeTR (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRL, in double theWL, in double theLtransL, in double theLthinL, + in double theRR, in double theWR, in double theLtransR, in double theLthinR, + in double theRI, in double theWI, in double theLtransI, in double theLthinI, + in boolean theHexMesh); + /*! + * \brief 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 theRL Internal radius of left thickness reduction + * \param theWL Width of left thickness reduction + * \param theLtransL Length of left transition part + * \param theLthinL Length of left thin part + * + * \param theRR Internal radius of right thickness reduction + * \param theWR Width of right thickness reduction + * \param theLtransR Length of right transition part + * \param theLthinR Length of right thin part + * + * \param theRI Internal radius of incident thickness reduction + * \param theWI Width of incident thickness reduction + * \param theLtransI Length of incident transition part + * \param theLthinI Length of incident thin part + * + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (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_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeTRWithPosition + (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRL, in double theWL, in double theLtransL, in double theLthinL, + in double theRR, in double theWR, in double theLtransR, in double theLthinR, + in double theRI, in double theWI, in double theLtransI, in double theLthinI, + in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + /*! + * \brief 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 theRL Internal radius of left thickness reduction + * \param theWL Width of left thickness reduction + * \param theLtransL Length of left transition part + * \param theLthinL Length of left thin part + * + * \param theRR Internal radius of right thickness reduction + * \param theWR Width of right thickness reduction + * \param theLtransR Length of right transition part + * \param theLthinR Length of right thin part + * + * \param theRI Internal radius of incident thickness reduction + * \param theWI Width of incident thickness reduction + * \param theLtransI Length of incident transition part + * \param theLthinI Length of incident thin part + * + * \param theH Height of the chamfer. + * \param theW Width of the chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeTRChamfer + (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRL, in double theWL, in double theLtransL, in double theLthinL, + in double theRR, in double theWR, in double theLtransR, in double theLthinR, + in double theRI, in double theWI, in double theLtransI, in double theLthinI, + in double theH, in double theW, in boolean theHexMesh); + /*! + * \brief 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 theRL Internal radius of left thickness reduction + * \param theWL Width of left thickness reduction + * \param theLtransL Length of left transition part + * \param theLthinL Length of left thin part + * + * \param theRR Internal radius of right thickness reduction + * \param theWR Width of right thickness reduction + * \param theLtransR Length of right transition part + * \param theLthinR Length of right thin part + * + * \param theRI Internal radius of incident thickness reduction + * \param theWI Width of incident thickness reduction + * \param theLtransI Length of incident transition part + * \param theLthinI Length of incident thin part + * + * \param theH Height of the chamfer. + * \param theW Width of the chamfer. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (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_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeTRChamferWithPosition + (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRL, in double theWL, in double theLtransL, in double theLthinL, + in double theRR, in double theWR, in double theLtransR, in double theLthinR, + in double theRI, in double theWI, in double theLtransI, in double theLthinI, + in double theH, in double theW, in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + /*! + * \brief 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 theRL Internal radius of left thickness reduction + * \param theWL Width of left thickness reduction + * \param theLtransL Length of left transition part + * \param theLthinL Length of left thin part + * + * \param theRR Internal radius of right thickness reduction + * \param theWR Width of right thickness reduction + * \param theLtransR Length of right transition part + * \param theLthinR Length of right thin part + * + * \param theRI Internal radius of incident thickness reduction + * \param theWI Width of incident thickness reduction + * \param theLtransI Length of incident transition part + * \param theLthinI Length of incident thin part + * + * \param theRF Radius of curvature of fillet. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) + * \return List of GEOM_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeTRFillet + (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRL, in double theWL, in double theLtransL, in double theLthinL, + in double theRR, in double theWR, in double theLtransR, in double theLthinR, + in double theRI, in double theWI, in double theLtransI, in double theLthinI, + in double theRF, in boolean theHexMesh); + /*! + * \brief 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 theRL Internal radius of left thickness reduction + * \param theWL Width of left thickness reduction + * \param theLtransL Length of left transition part + * \param theLthinL Length of left thin part + * + * \param theRR Internal radius of right thickness reduction + * \param theWR Width of right thickness reduction + * \param theLtransR Length of right transition part + * \param theLthinR Length of right thin part + * + * \param theRI Internal radius of incident thickness reduction + * \param theWI Width of incident thickness reduction + * \param theLtransI Length of incident transition part + * \param theLthinI Length of incident thin part + * + * \param theRF Radius of curvature of fillet. + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (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_Object, containing the created shape and propagation groups. + */ + ListOfGO MakePipeTShapeTRFilletWithPosition + (in double theR1, in double theW1, in double theL1, + in double theR2, in double theW2, in double theL2, + in double theRL, in double theWL, in double theLtransL, in double theLthinL, + in double theRR, in double theWR, in double theLtransR, in double theLthinR, + in double theRI, in double theWI, in double theLtransI, in double theLthinI, + in double theRF, in boolean theHexMesh, + in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); + /*! * This function allows to create a disk already divided into blocks. It * can be use to create divided pipes for later meshing in hexaedra. diff --git a/resources/Makefile.am b/resources/Makefile.am index 57c92dd2d..efee8ce49 100644 --- a/resources/Makefile.am +++ b/resources/Makefile.am @@ -244,7 +244,7 @@ coordsys.png \ translation.png ADVANCED_RESOURCES = -ADVANCED_RESOURCES += pipetshape.png tree_pipetshape.png pipetshape_import_icon.png +ADVANCED_RESOURCES += pipetshape.png tree_pipetshape.png pipetshape_import_icon.png pipetshape_section.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 diff --git a/resources/pipetshape_section.png b/resources/pipetshape_section.png new file mode 100644 index 000000000..a2e93c4a7 Binary files /dev/null and b/resources/pipetshape_section.png differ diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx index bbf214274..3c2ede934 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -15,7 +15,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #include "AdvancedGUI_PipeTShapeDlg.h" @@ -26,964 +25,1229 @@ #include #include #include +#include #include #include -#include // OCCT Includes +#include +#include #include #include #include #include -#include #include -#include + +#include #include //================================================================================= // 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"))); - 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); - - tshapeScreenShotLabel = new QLabel(); - tshapeScreenShotLabel->setSizePolicy(QSizePolicy::Expanding, - QSizePolicy::Expanding); - tshapeScreenShotLabel->setAlignment(Qt::AlignCenter); - tshapeScreenShotLabel->setMinimumSize(100, 100); - - 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(); - - // 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(tshapeScreenShotLabel, 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_pipetshape_page.html"); - - Init(); +AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg (GeometryGUI* theGeometryGUI, QWidget* parent) + : GEOMBase_Skeleton(theGeometryGUI, parent, false) +{ + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + //QPixmap imageOp = aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE")); + QPixmap imageSel = aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")); + QPixmap imageImp = aResMgr->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT")); + imagePipeTShape = aResMgr->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); + imageReduction = aResMgr->loadPixmap("GEOM", tr("IMG_PIPETSHAPE_SECT")); + + setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE")); + + /***************************************************************/ + mainFrame()->GroupConstructors->setAttribute(Qt::WA_DeleteOnClose); + mainFrame()->GroupConstructors->close(); + + QTabWidget* aTabWidget = new QTabWidget (centralWidget()); + + QGridLayout* myMainLayout = new QGridLayout (centralWidget()); + myMainLayout->setMargin(0); + myMainLayout->setSpacing(6); + + // Main parameters + QGroupBox* GroupMain = new QGroupBox(); + QGridLayout* layoutGroupMain = new QGridLayout (GroupMain); + + 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")); + MainTubeGroupParams->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); // ?? + + 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); + + LabelImgPipeTShape = new QLabel(); + LabelImgPipeTShape->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + LabelImgPipeTShape->setAlignment(Qt::AlignCenter); + LabelImgPipeTShape->setMinimumSize(300, 300); + + layoutGroupMain->addWidget(MainTubeGroupParams, 0, 0, 1, 1); + layoutGroupMain->addWidget(IncidentTubeGroupParams, 1, 0, 1, 1); + layoutGroupMain->addWidget(ChamferGroupParams, 2, 0, 1, 1); + layoutGroupMain->addWidget(FilletGroupParams, 3, 0, 1, 1); + layoutGroupMain->addWidget(HexMeshCheckBox, 4, 0, 1, 1); + + layoutGroupMain->addWidget(LabelImgPipeTShape, 0, 1, 5, 1); + layoutGroupMain->setColumnStretch(1, 1); // stretch of column 0 is supposed 0 by default + + // Thickness reduction parameters + QGroupBox* GroupReduct = new QGroupBox(); + QGridLayout* layoutGroupReduct = new QGridLayout (GroupReduct); + + LReductionGroupParams = new AdvancedGUI_4Spin(); + LReductionGroupParams->GroupBox1->setCheckable(true); + LReductionGroupParams->GroupBox1->setChecked(false); + LReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_LEFT_TR")); + LReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("L")); + LReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("L")); + LReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("L")); + LReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("L")); + + RReductionGroupParams = new AdvancedGUI_4Spin(); + RReductionGroupParams->GroupBox1->setCheckable(true); + RReductionGroupParams->GroupBox1->setChecked(false); + RReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_RIGHT_TR")); + RReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("R")); + RReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("R")); + RReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("R")); + RReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("R")); + + IReductionGroupParams = new AdvancedGUI_4Spin(); + IReductionGroupParams->GroupBox1->setCheckable(true); + IReductionGroupParams->GroupBox1->setChecked(false); + IReductionGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_INCI_TR")); + IReductionGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_TR_R").arg("I")); + IReductionGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_TR_W").arg("I")); + IReductionGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_TR_L_TRANS").arg("I")); + IReductionGroupParams->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_TR_L_THIN").arg("I")); + + LabelImgReduction = new QLabel(); + LabelImgReduction->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + LabelImgReduction->setAlignment(Qt::AlignCenter); + LabelImgReduction->setMinimumSize(300, 300); + + layoutGroupReduct->addWidget(LReductionGroupParams->GroupBox1, 0, 0, 1, 1); + layoutGroupReduct->addWidget(RReductionGroupParams->GroupBox1, 1, 0, 1, 1); + layoutGroupReduct->addWidget(IReductionGroupParams->GroupBox1, 2, 0, 1, 1); + + layoutGroupReduct->addWidget(LabelImgReduction, 0, 1, 3, 1); + layoutGroupReduct->setColumnStretch(1, 1); // stretch of column 0 is supposed 0 by default + + // Position parameters + QGroupBox* GroupPos = new QGroupBox(); + QVBoxLayout* layoutGroupPos = new QVBoxLayout (GroupPos); + + 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(); + + layoutGroupPos->addWidget(JunctionPointsSel); + layoutGroupPos->addStretch(); + + //aTabWidget->addTab(GroupMain, imageOp, tr("GEOM_PIPETSHAPE_GROUPMAIN")); + aTabWidget->addTab(GroupMain, tr("GEOM_PIPETSHAPE_GROUPMAIN")); + aTabWidget->addTab(GroupReduct, tr("GEOM_PIPETSHAPE_GROUPREDUCT")); + aTabWidget->addTab(GroupPos, tr("GEOM_PIPETSHAPE_GROUPPOS")); + + myMainLayout->addWidget(aTabWidget, 0, 0, 1, 1); + connect(aTabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int))); + /***************************************************************/ + + setHelpFileName("create_pipetshape_page.html"); + + Init(); } //================================================================================= // Destructor //================================================================================= AdvancedGUI_PipeTShapeDlg::~AdvancedGUI_PipeTShapeDlg() { - // no need to delete child widgets, Qt does it all for us + // 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); - - 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); - - CssNormal = QString("QDoubleSpinBox {"); - CssNormal.append(MainTubeGroupParams->SpinBox_DZ->styleSheet()); - CssNormal.append("}"); - CssNormal.append("\nQPushButton {"); - CssNormal.append(JunctionPointsSel->PushButton4->styleSheet()); - CssNormal.append("}"); - CssAcceptable = "QDoubleSpinBox, QPushButton {background-color: rgb(85, 170, 127)}"; - CssRefused = "QDoubleSpinBox, QPushButton {background-color: rgb(255, 0, 0)}"; - - showOnlyPreviewControl(); - - // 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")); - updateTshapeScreenshotLabel(); - processPreview(); +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); + double minValue = Precision::Approximation(); + + 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, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(MainTubeGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(MainTubeGroupParams->SpinBox_DZ, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(IncidentTubeGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(IncidentTubeGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(IncidentTubeGroupParams->SpinBox_DZ, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(ChamferGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(ChamferGroupParams->SpinBox_DY, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(FilletGroupParams->SpinBox_DX, minValue, COORD_MAX, step, "length_precision"); + + initSpinBox(LReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(LReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(LReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(LReductionGroupParams->SpinBox4, 0., COORD_MAX, step, "length_precision"); + + initSpinBox(RReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(RReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(RReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(RReductionGroupParams->SpinBox4, 0., COORD_MAX, step, "length_precision"); + + initSpinBox(IReductionGroupParams->SpinBox1, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(IReductionGroupParams->SpinBox2, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(IReductionGroupParams->SpinBox3, minValue, COORD_MAX, step, "length_precision"); + initSpinBox(IReductionGroupParams->SpinBox4, 0., 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); + + LReductionGroupParams->SpinBox1->setValue(60); + LReductionGroupParams->SpinBox2->setValue(30); + LReductionGroupParams->SpinBox3->setValue(40); + LReductionGroupParams->SpinBox4->setValue(20); + + RReductionGroupParams->SpinBox1->setValue(60); + RReductionGroupParams->SpinBox2->setValue(30); + RReductionGroupParams->SpinBox3->setValue(40); + RReductionGroupParams->SpinBox4->setValue(20); + + IReductionGroupParams->SpinBox1->setValue(40); + IReductionGroupParams->SpinBox2->setValue(10); + IReductionGroupParams->SpinBox3->setValue(30); + IReductionGroupParams->SpinBox4->setValue(15); + + CssNormal = QString("QDoubleSpinBox {"); + CssNormal.append(MainTubeGroupParams->SpinBox_DZ->styleSheet()); + CssNormal.append("}"); + CssNormal.append("\nQPushButton {"); + CssNormal.append(JunctionPointsSel->PushButton4->styleSheet()); + CssNormal.append("}"); + CssAcceptable = "QDoubleSpinBox, QPushButton {background-color: rgb(85, 170, 127)}"; + CssRefused = "QDoubleSpinBox, QPushButton {background-color: rgb(255, 0, 0)}"; + + showOnlyPreviewControl(); + + // 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))); + //connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); + // 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")); + + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); + + updateLabelImgPipeTShape(); + LabelImgReduction->setPixmap(imageReduction.scaled(LabelImgReduction->size(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation)); + processPreview(); +} + +//================================================================================= +// function : currentChanged() +// purpose : Tab widget management +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::currentChanged (int tabId) +{ + if (tabId == 0 || tabId == 1) + resizeEvent(NULL); } //================================================================================= // 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); - processPreview(); - } - } +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); + processPreview(); + } } - 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); - processPreview(); - } - } + } + 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); + processPreview(); + } } + } } //================================================================================= // 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")); - - updateTshapeScreenshotLabel(); +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")); + + updateLabelImgPipeTShape(); } //================================================================================= // 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(""); - processPreview(); - } +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(""); + processPreview(); + } } //================================================================================= // function : ValueChangedInSpinBox() // purpose : //================================================================================= -void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox(double newValue) +void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox (double newValue) { - if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3) - CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); - processPreview(); + if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); } //================================================================================= // 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) { - Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO); - if (!CORBA::is_nil(aSelectedObject)) { - 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->_is_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); - processPreview(); +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) { + Handle(SALOME_InteractiveObject) anIO = aSelList.First(); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO); + if (!CORBA::is_nil(aSelectedObject)) { + 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->_is_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(); + } } + } -// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First()); -// if (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(); -// } + if (myOkPoint1 && myOkPoint2 && myOkPoint3) { + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } } //================================================================================= // 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())); +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); +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); + + LReductionGroupParams->SpinBox1->setSingleStep(step); + LReductionGroupParams->SpinBox2->setSingleStep(step); + LReductionGroupParams->SpinBox3->setSingleStep(step); + LReductionGroupParams->SpinBox4->setSingleStep(step); + + RReductionGroupParams->SpinBox1->setSingleStep(step); + RReductionGroupParams->SpinBox2->setSingleStep(step); + RReductionGroupParams->SpinBox3->setSingleStep(step); + RReductionGroupParams->SpinBox4->setSingleStep(step); + + IReductionGroupParams->SpinBox1->setSingleStep(step); + IReductionGroupParams->SpinBox2->setSingleStep(step); + IReductionGroupParams->SpinBox3->setSingleStep(step); + IReductionGroupParams->SpinBox4->setSingleStep(step); } //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= -void AdvancedGUI_PipeTShapeDlg::ClickOnOk() { +void AdvancedGUI_PipeTShapeDlg::ClickOnOk() +{ setIsApplyAndClose( true ); - if (ClickOnApply()) - ClickOnCancel(); + if (ClickOnApply()) + ClickOnCancel(); } //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= -bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() { - if (!onAccept()) - return false; +bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() +{ + if (!onAccept()) + return false; - initName(); + initName(); - return true; + 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); - processPreview(); +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); + processPreview(); } //================================================================================= // function : enterEvent [REDEFINED] // purpose : //================================================================================= -void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) { - if (!mainFrame()->GroupConstructors->isEnabled()) - ActivateThisDialog(); +void AdvancedGUI_PipeTShapeDlg::enterEvent (QEvent*) +{ + if (!mainFrame()->GroupButtons->isEnabled()) + ActivateThisDialog(); } //================================================================================= // function : resizeEvent [REDEFINED] // purpose : //================================================================================= -void AdvancedGUI_PipeTShapeDlg::resizeEvent(QResizeEvent */*event*/) { - QSize scaledSize = imagePipeTShape.size(); - scaledSize.scale(tshapeScreenShotLabel->size(), Qt::KeepAspectRatio); - if (!tshapeScreenShotLabel->pixmap() - || scaledSize != tshapeScreenShotLabel->pixmap()->size()) - updateTshapeScreenshotLabel(); +void AdvancedGUI_PipeTShapeDlg::resizeEvent (QResizeEvent */*event*/) +{ + QSize scaledSize1 = imagePipeTShape.size(); + scaledSize1.scale(LabelImgPipeTShape->size(), Qt::KeepAspectRatio); + if (!LabelImgPipeTShape->pixmap() || scaledSize1 != LabelImgPipeTShape->pixmap()->size()) + updateLabelImgPipeTShape(); + + QSize scaledSize2 = imageReduction.size(); + scaledSize2.scale(LabelImgReduction->size(), Qt::KeepAspectRatio); + if (!LabelImgReduction->pixmap() || scaledSize2 != LabelImgReduction->pixmap()->size()) + LabelImgReduction->setPixmap(imageReduction.scaled(LabelImgReduction->size(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation)); } //================================================================================= -// function : updateTshapeScreenshotLabel +// function : updateLabelImgPipeTShape // purpose : //================================================================================= -void AdvancedGUI_PipeTShapeDlg::updateTshapeScreenshotLabel() { - tshapeScreenShotLabel->setPixmap(imagePipeTShape.scaled(tshapeScreenShotLabel->size(), - Qt::KeepAspectRatio, - Qt::SmoothTransformation)); +void AdvancedGUI_PipeTShapeDlg::updateLabelImgPipeTShape() +{ + LabelImgPipeTShape->setPixmap(imagePipeTShape.scaled(LabelImgPipeTShape->size(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation)); } //================================================================================= // 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")); - updateTshapeScreenshotLabel(); - if (myOkPoint1 && myOkPoint2 && myOkPoint3) - CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); - processPreview(); - } 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")); - updateTshapeScreenshotLabel(); - if (myOkPoint1 && myOkPoint2 && myOkPoint3) - CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); - processPreview(); - } +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")); + + updateLabelImgPipeTShape(); + if (myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } + 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")); + updateLabelImgPipeTShape(); + if (myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); + processPreview(); + } } //================================================================================= // 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->UnRegister(); - } - HexMeshCheckBox->setChecked(hexMeshState); - } catch (const SALOME::SALOME_Exception& e) { - SalomeApp_Tools::QtCatchCorbaException(e); - } - - isPreview = false; - - if (update) - updateViewer(); +void AdvancedGUI_PipeTShapeDlg::DisplayPreview (const bool activate, const bool update, + const bool toRemoveFromEngine, const double lineWidth, + const int displayMode, const int color) +{ + QString msg; + if (!isValid(msg)) { + erasePreview(update); + 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->UnRegister(); + } + HexMeshCheckBox->setChecked(hexMeshState); + } catch (const SALOME::SALOME_Exception& e) { + SalomeApp_Tools::QtCatchCorbaException(e); + } + + if (update) + updateViewer(); } + //================================================================================= // function : createOperation // purpose : //================================================================================= -GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() { - return getGeomEngine()->GetIAdvancedOperations(getStudyId()); +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; +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; + + if (LReductionGroupParams->GroupBox1->isChecked()) { + ok = LReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok; + ok = LReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok; + ok = LReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok; + ok = LReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok; + } + if (RReductionGroupParams->GroupBox1->isChecked()) { + ok = RReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok; + ok = RReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok; + ok = RReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok; + ok = RReductionGroupParams->SpinBox4->isValid(msg, !IsPreview()) && ok; + } + if (IReductionGroupParams->GroupBox1->isChecked()) { + ok = IReductionGroupParams->SpinBox1->isValid(msg, !IsPreview()) && ok; + ok = IReductionGroupParams->SpinBox2->isValid(msg, !IsPreview()) && ok; + ok = IReductionGroupParams->SpinBox3->isValid(msg, !IsPreview()) && ok; + ok = IReductionGroupParams->SpinBox4->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) { +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(CssNormal); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton4->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton5->setStyleSheet(CssNormal); - MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); - IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); - JunctionPointsSel->PushButton4->setStyleSheet(CssNormal); - JunctionPointsSel->PushButton5->setStyleSheet(CssNormal); + CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value(); + CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value(); - CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value(); - CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value(); + JunctionPointsSel->LineEdit4->setText(""); + JunctionPointsSel->LineEdit5->setText(""); - 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; - 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 ( 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; + } + + 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)); + + if (fabs(newL1 - theL1) > Precision::Approximation()) { + if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) && + (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) { + 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(CssAcceptable); + JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable); } - if (Abs(d13) <= Precision::Confusion()) { -// SetErrorCode("Junctions points P1 and P3 are identical"); - return false; + else { + MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); + JunctionPointsSel->PushButton4->setStyleSheet(CssRefused); } - if (Abs(d23) <= Precision::Confusion()) { -// SetErrorCode("Junctions points P2 and P3 are identical"); - return false; + } + else { + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton4->setStyleSheet(CssNormal); + } + + if (fabs(newL2 - theL2) > Precision::Approximation()) { + if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) && + (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) { + 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(CssAcceptable); + JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable); } - - 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)); - - if (fabs(newL1 - theL1) > Precision::Approximation()) { - if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) && - (newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) { - 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(CssAcceptable); - JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable); - } - else { - MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); - MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); - JunctionPointsSel->PushButton4->setStyleSheet(CssRefused); - } - } else { - MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); - JunctionPointsSel->PushButton4->setStyleSheet(CssNormal); - } - - if (fabs(newL2 - theL2) > Precision::Approximation()) { - if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) && - (newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) { - 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(CssAcceptable); - JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable); - } - else { - IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); - IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); - JunctionPointsSel->PushButton5->setStyleSheet(CssRefused); - } - } - else { - IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); - JunctionPointsSel->PushButton5->setStyleSheet(CssNormal); + IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); + JunctionPointsSel->PushButton5->setStyleSheet(CssRefused); } + } + else { + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton5->setStyleSheet(CssNormal); + } - return true; + return true; } -bool AdvancedGUI_PipeTShapeDlg::execute(ObjectList& objects) { - - if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3) - CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); +//================================================================================= +// function : execute +// purpose : +//================================================================================= +bool AdvancedGUI_PipeTShapeDlg::execute (ObjectList& objects) +{ + if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3) + CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); - return executeNoCheck(objects); + return executeNoCheck(objects); } //================================================================================= -// function : execute +// function : executeNoCheck // 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; +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(); + + // Thickness reductions + CORBA::Double theRL = 0., theWL = 0., theLtransL = 0., theLthinL = 0.; + CORBA::Double theRR = 0., theWR = 0., theLtransR = 0., theLthinR = 0.; + CORBA::Double theRI = 0., theWI = 0., theLtransI = 0., theLthinI = 0.; + + if (LReductionGroupParams->GroupBox1->isChecked()) { + theRL = LReductionGroupParams->SpinBox1->value(); + theWL = LReductionGroupParams->SpinBox2->value(); + theLtransL = LReductionGroupParams->SpinBox3->value(); + theLthinL = LReductionGroupParams->SpinBox4->value(); + } + if (RReductionGroupParams->GroupBox1->isChecked()) { + theRR = RReductionGroupParams->SpinBox1->value(); + theWR = RReductionGroupParams->SpinBox2->value(); + theLtransR = RReductionGroupParams->SpinBox3->value(); + theLthinR = RReductionGroupParams->SpinBox4->value(); + } + if (IReductionGroupParams->GroupBox1->isChecked()) { + theRI = IReductionGroupParams->SpinBox1->value(); + theWI = IReductionGroupParams->SpinBox2->value(); + theLtransI = IReductionGroupParams->SpinBox3->value(); + theLthinI = IReductionGroupParams->SpinBox4->value(); + } + + //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->MakePipeTShapeTRChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theH, theW, theHexMesh, myPoint1, myPoint2, myPoint3); + else + anObj = anOper->MakePipeTShapeTRChamfer(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theH, theW, theHexMesh); + } + else if (FilletGroupParams->GroupBox1->isChecked()) { + if (JunctionPointsSel->GroupBox1->isChecked()) + anObj = anOper->MakePipeTShapeTRFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theRF, theHexMesh, myPoint1, myPoint2, myPoint3); + else + anObj = anOper->MakePipeTShapeTRFillet(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theRF, theHexMesh); + } + else { + if (JunctionPointsSel->GroupBox1->isChecked()) + anObj = anOper->MakePipeTShapeTRWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theHexMesh, myPoint1, myPoint2, myPoint3); + else + anObj = anOper->MakePipeTShapeTR(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + 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 + + // Thickness reductions + if (LReductionGroupParams->GroupBox1->isChecked()) { + aParameters << LReductionGroupParams->SpinBox1->text(); + aParameters << LReductionGroupParams->SpinBox2->text(); + aParameters << LReductionGroupParams->SpinBox3->text(); + aParameters << LReductionGroupParams->SpinBox4->text(); + } + else { + aParameters << "0" << "0" << "0" << "0"; + } + if (RReductionGroupParams->GroupBox1->isChecked()) { + aParameters << RReductionGroupParams->SpinBox1->text(); + aParameters << RReductionGroupParams->SpinBox2->text(); + aParameters << RReductionGroupParams->SpinBox3->text(); + aParameters << RReductionGroupParams->SpinBox4->text(); + } + else { + aParameters << "0" << "0" << "0" << "0"; + } + if (IReductionGroupParams->GroupBox1->isChecked()) { + aParameters << IReductionGroupParams->SpinBox1->text(); + aParameters << IReductionGroupParams->SpinBox2->text(); + aParameters << IReductionGroupParams->SpinBox3->text(); + aParameters << IReductionGroupParams->SpinBox4->text(); + } + else { + aParameters << "0" << "0" << "0" << "0"; + } + + 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(); +void AdvancedGUI_PipeTShapeDlg::restoreSubShapes (SALOMEDS::Study_ptr theStudy, + SALOMEDS::SObject_ptr theSObject) +{ + SALOMEDS::GenericAttribute_var anAttr; + if (!theSObject->FindAttribute(anAttr, "AttributeIOR")) + return; - // 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; + SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + CORBA::String_var anIORso = anAttrIOR->Value(); - ObjectList::iterator it = pipeTShapeGroupObjects.begin(); + // 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; - for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) { - getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather); - } + ObjectList::iterator it = pipeTShapeGroupObjects.begin(); + for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) { + getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather); + } } //================================================================================= // function : processPreview() // purpose : Display preview if CheckBoxPreview is checked //================================================================================= -void AdvancedGUI_PipeTShapeDlg::processPreview() { - if(mainFrame()->CheckBoxPreview->isChecked()) +void AdvancedGUI_PipeTShapeDlg::processPreview() +{ + if (mainFrame()->CheckBoxPreview->isChecked()) DisplayPreview(); else erasePreview(true); } + +//================================================================================= +// function : AdvancedGUI_4Spin +// purpose : +//================================================================================= +AdvancedGUI_4Spin::AdvancedGUI_4Spin() +{ + GroupBox1 = new QGroupBox (); + + gridLayout1 = new QGridLayout (GroupBox1); + gridLayout1->setSpacing(6); + gridLayout1->setContentsMargins(11, 11, 11, 11); + gridLayout1->setHorizontalSpacing(6); + gridLayout1->setVerticalSpacing(6); + gridLayout1->setContentsMargins(9, 9, 9, 9); + + TextLabel1 = new QLabel (GroupBox1); + TextLabel2 = new QLabel (GroupBox1); + TextLabel3 = new QLabel (GroupBox1); + TextLabel4 = new QLabel (GroupBox1); + + SpinBox1 = new SalomeApp_DoubleSpinBox (GroupBox1); + SpinBox2 = new SalomeApp_DoubleSpinBox (GroupBox1); + SpinBox3 = new SalomeApp_DoubleSpinBox (GroupBox1); + SpinBox4 = new SalomeApp_DoubleSpinBox (GroupBox1); + + SpinBox1->setMinimumWidth(60); + SpinBox2->setMinimumWidth(60); + SpinBox3->setMinimumWidth(60); + SpinBox4->setMinimumWidth(60); + + gridLayout1->addWidget(TextLabel1, 0, 0, 1, 1); + gridLayout1->addWidget(TextLabel2, 1, 0, 1, 1); + gridLayout1->addWidget(TextLabel3, 2, 0, 1, 1); + gridLayout1->addWidget(TextLabel4, 3, 0, 1, 1); + + gridLayout1->addWidget(SpinBox1, 0, 1, 1, 1); + gridLayout1->addWidget(SpinBox2, 1, 1, 1, 1); + gridLayout1->addWidget(SpinBox3, 2, 1, 1, 1); + gridLayout1->addWidget(SpinBox4, 3, 1, 1, 1); +} + +//================================================================================= +// function : ~AdvancedGUI_4Spin() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +AdvancedGUI_4Spin::~AdvancedGUI_4Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h index 04147ea96..670c2f9d0 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h @@ -15,7 +15,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #ifndef ADVANCEDGUI_PIPETSHAPEDLG_H #define ADVANCEDGUI_PIPETSHAPEDLG_H @@ -25,72 +24,114 @@ class DlgRef_1Spin; class DlgRef_2Spin; class DlgRef_3Spin; +class DlgRef_4Spin; class DlgRef_3Sel; class DlgRef_6Sel; class QCheckBox; class QLineEdit; class QLabel; +class QGridLayout; +class QGroupBox; +class SalomeApp_DoubleSpinBox; + +//================================================================================= +// class : AdvancedGUI_4Spin +// purpose : +//================================================================================= +class AdvancedGUI_4Spin : public QWidget +{ + Q_OBJECT + + public: + AdvancedGUI_4Spin (); + ~AdvancedGUI_4Spin(); + + public: + QGroupBox *GroupBox1; + QGridLayout *gridLayout1; + + QLabel *TextLabel1; + QLabel *TextLabel2; + QLabel *TextLabel3; + QLabel *TextLabel4; + SalomeApp_DoubleSpinBox *SpinBox1; + SalomeApp_DoubleSpinBox *SpinBox2; + SalomeApp_DoubleSpinBox *SpinBox3; + SalomeApp_DoubleSpinBox *SpinBox4; +}; //================================================================================= // class : AdvancedGUI_PipeTShapeDlg // purpose : //================================================================================= -class AdvancedGUI_PipeTShapeDlg: public GEOMBase_Skeleton { -Q_OBJECT +class AdvancedGUI_PipeTShapeDlg: public GEOMBase_Skeleton +{ + Q_OBJECT public: - AdvancedGUI_PipeTShapeDlg(GeometryGUI*, QWidget* = 0); - ~AdvancedGUI_PipeTShapeDlg(); + 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); + // 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*); - void resizeEvent(QResizeEvent *event); - void updateTshapeScreenshotLabel(); - bool CheckCompatiblePosition(GEOM::GEOM_Object_var theP1, - GEOM::GEOM_Object_var theP2, - GEOM::GEOM_Object_var theP3, double theTolerance); + void Init(); + void enterEvent (QEvent*); + void resizeEvent (QResizeEvent *event); + void updateLabelImgPipeTShape(); + bool CheckCompatiblePosition (GEOM::GEOM_Object_var theP1, + GEOM::GEOM_Object_var theP2, + GEOM::GEOM_Object_var theP3, double theTolerance); private: - QPixmap imagePipeTShape; - QLabel* tshapeScreenShotLabel; - DlgRef_3Spin* MainTubeGroupParams; - DlgRef_3Spin* IncidentTubeGroupParams; - DlgRef_2Spin* ChamferGroupParams; - DlgRef_1Spin* FilletGroupParams; - DlgRef_6Sel* JunctionPointsSel; - QPixmap imageImp; - QString CssNormal, CssAcceptable, CssRefused; - QCheckBox* HexMeshCheckBox; - GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; - bool myOkPoint1, myOkPoint2, myOkPoint3; - bool isPreview; - ObjectList pipeTShapeGroupObjects; + QPixmap imagePipeTShape; + QPixmap imageReduction; + QLabel* LabelImgPipeTShape; + QLabel* LabelImgReduction; + + // Main parameters + DlgRef_3Spin* MainTubeGroupParams; + DlgRef_3Spin* IncidentTubeGroupParams; + DlgRef_2Spin* ChamferGroupParams; + DlgRef_1Spin* FilletGroupParams; + QCheckBox* HexMeshCheckBox; + + // Thickness reduction parameters + AdvancedGUI_4Spin* LReductionGroupParams; + AdvancedGUI_4Spin* RReductionGroupParams; + AdvancedGUI_4Spin* IReductionGroupParams; + + // Position parameters + DlgRef_6Sel* JunctionPointsSel; + + QString CssNormal, CssAcceptable, CssRefused; + GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; + bool myOkPoint1, myOkPoint2, myOkPoint3; + 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); - virtual void processPreview(); - void SetPosition(bool); - void ChamferOrFillet(bool); - void SetDoubleSpinBoxStep(double); - void ValueChangedInSpinBox( double ); - void UpdatePicture(QWidget* old, QWidget* now); - void ApplyNewDimensions(); - bool executeNoCheck( ObjectList& objects ); + void ClickOnOk(); + bool ClickOnApply(); + void ActivateThisDialog(); + void currentChanged (int); + 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); + virtual void processPreview(); + 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 diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index e375fc5d5..f0bfad5a7 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1207,6 +1207,10 @@ DLG_PIPETSHAPE dlg_pipetshape.png + + IMG_PIPETSHAPE_SECT + pipetshape_section.png + DLG_PIPETSHAPE_L1 dlg_pipetshapel1.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 87d23adbe..28275e13c 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -5801,6 +5801,46 @@ Do you want to create new material? GEOM_PIPE_TSHAPE_POSITION_LBL_L2 New L2 + + GEOM_PIPE_TSHAPE_LEFT_TR + Left thickness reduction + + + GEOM_PIPE_TSHAPE_RIGHT_TR + Right thickness reduction + + + GEOM_PIPE_TSHAPE_INCI_TR + Incident thickness reduction + + + GEOM_PIPE_TSHAPE_TR_R + Radius (r%1) + + + GEOM_PIPE_TSHAPE_TR_W + Width (w%1) + + + GEOM_PIPE_TSHAPE_TR_L_TRANS + Transition length (ltrans%1) + + + GEOM_PIPE_TSHAPE_TR_L_THIN + Thin part length (lthin%1) + + + GEOM_PIPETSHAPE_GROUPMAIN + Main parameters + + + GEOM_PIPETSHAPE_GROUPREDUCT + Thickness reduction + + + GEOM_PIPETSHAPE_GROUPPOS + Position + GEOMToolsGUI_PublishDlg diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index d07b791f5..70fb7487d 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -5784,6 +5784,46 @@ Voulez-vous en créer un nouveau ? GEOM_PIPE_TSHAPE_POSITION_LBL_L2 Nouvelle L2 + + GEOM_PIPE_TSHAPE_LEFT_TR + Left thickness reduction + + + GEOM_PIPE_TSHAPE_RIGHT_TR + Right thickness reduction + + + GEOM_PIPE_TSHAPE_INCI_TR + Incident thickness reduction + + + GEOM_PIPE_TSHAPE_TR_R + Radius (r%1) + + + GEOM_PIPE_TSHAPE_TR_W + Width (w%1) + + + GEOM_PIPE_TSHAPE_TR_L_TRANS + Transition length (ltrans%1) + + + GEOM_PIPE_TSHAPE_TR_L_THIN + Thin part length (lthin%1) + + + GEOM_PIPETSHAPE_GROUPMAIN + Main parameters + + + GEOM_PIPETSHAPE_GROUPREDUCT + Thickness reduction + + + GEOM_PIPETSHAPE_GROUPPOS + Position + GEOMToolsGUI_PublishDlg diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 1582f9126..78d277f2a 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -18,13 +18,13 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #include #include #include #include #include +#include #include @@ -72,30 +72,6 @@ GEOMImpl_BooleanDriver::GEOMImpl_BooleanDriver() { } -void AddSimpleShapes(TopoDS_Shape theShape, TopTools_ListOfShape& theList) -{ - if (theShape.ShapeType() != TopAbs_COMPOUND && - theShape.ShapeType() != TopAbs_COMPSOLID) { - theList.Append(theShape); - return; - } - - TopTools_MapOfShape mapShape; - TopoDS_Iterator It (theShape, Standard_True, Standard_True); - - for (; It.More(); It.Next()) { - TopoDS_Shape aShape_i = It.Value(); - if (mapShape.Add(aShape_i)) { - if (aShape_i.ShapeType() == TopAbs_COMPOUND || - aShape_i.ShapeType() == TopAbs_COMPSOLID) { - AddSimpleShapes(aShape_i, theList); - } else { - theList.Append(aShape_i); - } - } - } -} - //======================================================================= //function : Execute //purpose : @@ -131,8 +107,8 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const B.MakeCompound(C); TopTools_ListOfShape listShape1, listShape2; - AddSimpleShapes(aShape1, listShape1); - AddSimpleShapes(aShape2, listShape2); + GEOMUtils::AddSimpleShapes(aShape1, listShape1); + GEOMUtils::AddSimpleShapes(aShape2, listShape2); Standard_Boolean isCompound = (listShape1.Extent() > 1 || listShape2.Extent() > 1); @@ -174,7 +150,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const if (isCompound) { /* TopTools_ListOfShape listShapeC; - AddSimpleShapes(C, listShapeC); + GEOMUtils::AddSimpleShapes(C, listShapeC); TopTools_ListIteratorOfListOfShape itSubC (listShapeC); bool isOnlySolids = true; for (; itSubC.More(); itSubC.Next()) { @@ -203,8 +179,8 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const B.MakeCompound(C); TopTools_ListOfShape listShapes, listTools; - AddSimpleShapes(aShape1, listShapes); - AddSimpleShapes(aShape2, listTools); + GEOMUtils::AddSimpleShapes(aShape1, listShapes); + GEOMUtils::AddSimpleShapes(aShape2, listTools); Standard_Boolean isCompound = (listShapes.Extent() > 1); @@ -245,7 +221,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const if (isCompound) { /* TopTools_ListOfShape listShapeC; - AddSimpleShapes(C, listShapeC); + GEOMUtils::AddSimpleShapes(C, listShapeC); TopTools_ListIteratorOfListOfShape itSubC (listShapeC); bool isOnlySolids = true; for (; itSubC.More(); itSubC.Next()) { @@ -272,8 +248,8 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const /* Fix for NPAL15379: refused // Check arguments TopTools_ListOfShape listShape1, listShape2; - AddSimpleShapes(aShape1, listShape1); - AddSimpleShapes(aShape2, listShape2); + GEOMUtils::AddSimpleShapes(aShape1, listShape1); + GEOMUtils::AddSimpleShapes(aShape2, listShape2); Standard_Boolean isIntersect = Standard_False; @@ -360,8 +336,8 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const B.MakeCompound(C); TopTools_ListOfShape listShape1, listShape2; - AddSimpleShapes(aShape1, listShape1); - AddSimpleShapes(aShape2, listShape2); + GEOMUtils::AddSimpleShapes(aShape1, listShape1); + GEOMUtils::AddSimpleShapes(aShape2, listShape2); Standard_Boolean isCompound = (listShape1.Extent() > 1 || listShape2.Extent() > 1); @@ -433,7 +409,7 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute (TFunction_Logbook& log) const // as boolean operations always produce compound, lets simplify it // for the case, if it contains only one sub-shape TopTools_ListOfShape listShapeRes; - AddSimpleShapes(aShape, listShapeRes); + GEOMUtils::AddSimpleShapes(aShape, listShapeRes); if (listShapeRes.Extent() == 1) { aShape = listShapeRes.First(); if (aShape.IsNull()) return 0; diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 9b982e735..58e8f837e 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -19,20 +19,7 @@ // File : GEOMImpl_IAdvancedOperations.cxx // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -#include - -#include "GEOMImpl_Types.hxx" #include "GEOMImpl_IAdvancedOperations.hxx" -#include "GEOMImpl_IBasicOperations.hxx" -#include "GEOMImpl_IBooleanOperations.hxx" -#include "GEOMImpl_IShapesOperations.hxx" -#include "GEOMImpl_ITransformOperations.hxx" -#include "GEOMImpl_IBlocksOperations.hxx" -#include "GEOMImpl_I3DPrimOperations.hxx" -#include "GEOMImpl_ILocalOperations.hxx" -#include "GEOMImpl_IHealingOperations.hxx" - -#include "GEOMImpl_Gen.hxx" #include @@ -42,37 +29,65 @@ #include "GEOM_Function.hxx" #include "GEOM_PythonDump.hxx" +#include "GEOMUtils.hxx" +#include "GEOMAlgo_Splitter.hxx" +#include "GEOMImpl_Gen.hxx" +#include "GEOMImpl_Types.hxx" + +#include "GEOMImpl_IBasicOperations.hxx" +#include "GEOMImpl_IBooleanOperations.hxx" +#include "GEOMImpl_IShapesOperations.hxx" +#include "GEOMImpl_ITransformOperations.hxx" +#include "GEOMImpl_IBlocksOperations.hxx" +#include "GEOMImpl_I3DPrimOperations.hxx" +#include "GEOMImpl_ILocalOperations.hxx" +#include "GEOMImpl_IHealingOperations.hxx" + +#include "GEOMImpl_GlueDriver.hxx" #include "GEOMImpl_PipeTShapeDriver.hxx" #include "GEOMImpl_IPipeTShape.hxx" -#include -#include -// #include -// #include +#include "GEOMImpl_DividedDiskDriver.hxx" +#include "GEOMImpl_IDividedDisk.hxx" +// #include "GEOMImpl_DividedCylinderDriver.hxx" +// #include "GEOMImpl_IDividedCylinder.hxx" /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/ +#include +#include +#include +#include +#include + #include #include #include #include #include +#include #include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include -#include +#include +#include + +#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include #include +#include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC #define HALF_LENGTH_MAIN_PIPE "Main pipe half length" //"Tuyau principal - demi longueur" @@ -85,6 +100,8 @@ #define JUNCTION_FACE_2 "Junction 2" //"Face de jonction 2" #define JUNCTION_FACE_3 "Junction 3" //"Face de jonction 3" +#define FIND_GROUPS_BY_POINTS 1 + //============================================================================= /*! * Constructor @@ -242,6 +259,7 @@ bool GEOMImpl_IAdvancedOperations::CheckCompatiblePosition(double& theL1, double bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int shapeType, double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theH, double theW, double theRF, Handle(TColStd_HSequenceOfTransient) theSeq, gp_Trsf aTrsf) { @@ -411,6 +429,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int // == BEGIN } // == END + ///////////////////////// //// Groups of Edges //// ///////////////////////// @@ -424,10 +443,153 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int SetErrorCode("Propagation groups not found"); return false; } - Standard_Integer nbEdges, aNbGroups = aSeqPropagate->Length(); + Standard_Integer aNbGroups = aSeqPropagate->Length(); // Recover previous description to get rid of Propagate dump aFunction->SetDescription(theDesc); +#ifdef FIND_GROUPS_BY_POINTS + // BEGIN: new groups search + + // W2 R2 + // .----.-----.----. + // e| | | | | + // | | | | | + // . | | | . + // g / ''..| | |..'' \ + // f / ''''''' \ + // .---.--'.. | | | ..'--.---. + // |a \ '''...........''' / | + // |-------\------' | '------/-------. + // | \ | / | + // c| \ | / | + // | R1 \ | / | + // | \ | / | + // ._________________|_________________. + // | L1 | | + // | | | + // | | | + // b| | | + // | | | + // |-----------------|-----------------| + // | W1 | | + // '-----------------'-----------------' + // d + + // "Thickness" group (a) + gp_Pnt aPntA (-theL1, 0, theR1 + theW1/2.); + aPntA.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexA (aPntA); + TopoDS_Vertex aVertA = TopoDS::Vertex(mkVertexA.Shape()); + TopoDS_Shape anEdgeA = GEOMUtils::GetEdgeNearPoint(aShape, aVertA); + + // "Circular quarter of pipe" group (b) + gp_Pnt aPntB (-theL1, -aR1Ext * sin(M_PI/4.), -aR1Ext * sin(M_PI/4.)); + aPntB.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexB (aPntB); + TopoDS_Vertex aVertB = TopoDS::Vertex(mkVertexB.Shape()); + TopoDS_Shape anEdgeB = GEOMUtils::GetEdgeNearPoint(aShape, aVertB); + + // "Circular quarter of pipe" group (c) + gp_Pnt aPntC (-theL1, -aR1Ext * sin(M_PI/4.), aR1Ext * sin(M_PI/4.)); + aPntC.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexC (aPntC); + TopoDS_Vertex aVertC = TopoDS::Vertex(mkVertexC.Shape()); + TopoDS_Shape anEdgeC = GEOMUtils::GetEdgeNearPoint(aShape, aVertC); + + // "Main pipe half length" group (d) + gp_Pnt aPntD (-theL1/2., 0, -aR1Ext); + aPntD.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexD (aPntD); + TopoDS_Vertex aVertD = TopoDS::Vertex(mkVertexD.Shape()); + TopoDS_Shape anEdgeD = GEOMUtils::GetEdgeNearPoint(aShape, aVertD); + + // "Incident pipe half length" group (e) + double aTol10 = Precision::Confusion() * 10.; + gp_Pnt aPntE (-aR2Ext, 0, theL2 - aTol10); + aPntE.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexE (aPntE); + TopoDS_Vertex aVertE = TopoDS::Vertex(mkVertexE.Shape()); + TopoDS_Shape anEdgeE = GEOMUtils::GetEdgeNearPoint(aShape, aVertE); + + // "Flange" group (f) + double aFx = - aR2Ext - aTol10; + if (shapeType == TSHAPE_CHAMFER) + aFx -= theW; + else if (shapeType == TSHAPE_FILLET) + aFx -= theRF; + gp_Pnt aPntF (aFx, 0, aR1Ext); + aPntF.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexF (aPntF); + TopoDS_Vertex aVertF = TopoDS::Vertex(mkVertexF.Shape()); + TopoDS_Shape anEdgeF = GEOMUtils::GetEdgeNearPoint(aShape, aVertF); + + // "Chamfer or Fillet" group (g) + TopoDS_Shape anEdgeG; + if (shapeType == TSHAPE_CHAMFER) { + gp_Pnt aPntG (-aR2Ext - theW/2., 0, aR1Ext + theH/2.); + aPntG.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexG (aPntG); + TopoDS_Vertex aVertG = TopoDS::Vertex(mkVertexG.Shape()); + anEdgeG = GEOMUtils::GetEdgeNearPoint(aShape, aVertG); + } + else if (shapeType == TSHAPE_FILLET) { + gp_Pnt aPntG (-aR2Ext - theRF/2., 0, aR1Ext + theRF/2.); + aPntG.Transform(aTrsf); + BRepBuilderAPI_MakeVertex mkVertexG (aPntG); + TopoDS_Vertex aVertG = TopoDS::Vertex(mkVertexG.Shape()); + anEdgeG = GEOMUtils::GetEdgeNearPoint(aShape, aVertG); + } + + for (int i = 1 ; i <= aNbGroups; i++) { + 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); + + if (anEdgesMap.Contains(anEdgeA)) { // a + aGroup->SetName("THICKNESS"); + theSeq->Append(aGroup); + } + else if (anEdgesMap.Contains(anEdgeB)) { // b + aGroup->SetName("CIRCULAR_QUARTER_PIPE"); + theSeq->Append(aGroup); + } + else if (anEdgesMap.Contains(anEdgeC)) { // c + aGroup->SetName("CIRCULAR_QUARTER_PIPE"); + theSeq->Append(aGroup); + } + else if (anEdgesMap.Contains(anEdgeD)) { // d + aGroup->SetName("HALF_LENGTH_MAIN_PIPE"); + theSeq->Append(aGroup); + } + else if (anEdgesMap.Contains(anEdgeE)) { // e + aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE"); + theSeq->Append(aGroup); + } + else if (anEdgesMap.Contains(anEdgeF)) { // f + aGroup->SetName("FLANGE"); + theSeq->Append(aGroup); + } + else if (shapeType == TSHAPE_CHAMFER) { // g + if (anEdgesMap.Contains(anEdgeG)) { + aGroup->SetName("CHAMFER"); + theSeq->Append(aGroup); + } + } + else if (shapeType == TSHAPE_FILLET) { // g + if (anEdgesMap.Contains(anEdgeG)) { + aGroup->SetName("FILLET"); + theSeq->Append(aGroup); + } + } + else { + } + } + // END: new groups search +#else bool addGroup; bool circularFoundAndAdded = false; bool circularFound10 = false; @@ -439,23 +601,23 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int bool flangeFoundAndAdded = false; bool chamferOrFilletFound = false; - for (int i=1 ; i<= aNbGroups; i++) { + for (int i = 1 ; i <= aNbGroups; i++) { addGroup = false; Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(i)); - if(aGroup.IsNull()) + if (aGroup.IsNull()) continue; TopoDS_Shape aGroupShape = aGroup->GetValue(); - BRepBuilderAPI_Transform aTransformationShapeInv(aGroupShape, aTrsfInv, Standard_False); + BRepBuilderAPI_Transform aTransformationShapeInv (aGroupShape, aTrsfInv, Standard_False); TopoDS_Shape aGroupShapeTrsfInv = aTransformationShapeInv.Shape(); TopTools_IndexedMapOfShape anEdgesMap; TopExp::MapShapes(aGroupShapeTrsfInv,TopAbs_EDGE, anEdgesMap); - nbEdges = anEdgesMap.Extent(); + Standard_Integer nbEdges = anEdgesMap.Extent(); if (shapeType == TSHAPE_BASIC) { - if ((nbEdges == 21) || /*R1Ext = R2Ext*/(nbEdges == 17)){ + if ((nbEdges >= 21) || /*R1Ext = R2Ext*/(nbEdges == 17)) { // 17, 17+8*{1,2,3}, 21, 21+8*{1,2,3} addGroup = true; aGroup->SetName("THICKNESS"); } @@ -469,7 +631,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int else if (nbEdges == 8) { incidentPipeFound = true; mainPipeFound = false; - radialFound =false; + radialFound = false; flangeFound = false; TopExp_Explorer Ex(aGroupShapeTrsfInv,TopAbs_VERTEX); @@ -522,7 +684,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int continue; } else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) { - if (nbEdges == 25) { + if (nbEdges >= 25) { // 25, 25+8, 25+16, 25+24 addGroup = true; aGroup->SetName("THICKNESS"); } @@ -622,6 +784,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int if (addGroup) theSeq->Append(aGroup); } +#endif SetErrorCode(OK); return true; @@ -1078,7 +1241,8 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t TopoDS_Shape aShape = Te3->GetValue(); theShape->GetLastFunction()->SetValue(aShape); - } catch (Standard_Failure) { + } + catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return false; @@ -1193,6 +1357,224 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Objec return true; } +//======================================================================= +//function : MakePipeTShapeThicknessReduction +//purpose : Static method. Add thiskness reduction elements at the three +// open ends of the T-Shape. +//======================================================================= +TopoDS_Shape GEOMImpl_IAdvancedOperations::MakePipeTShapeThicknessReduction + (TopoDS_Shape theShape, + double r1, double w1, double l1, + double r2, double w2, double l2, + double rL, double wL, double ltransL, double lthinL, + double rR, double wR, double ltransR, double lthinR, + double rI, double wI, double ltransI, double lthinI, + bool fuseReductions) +{ + // Add thickness reduction elements + // at the three extremities: Left, Right and Incident + // + // ---------------------. + // W \ + // ---------------------. \ + // ^ \ '-----------------. + // |R \ Wthin | + // | '-----------------' + // v Rthin + // --.--.--.--.--.--.--.--.--.--.--.--.--.--.-- + // Ltrans Lthin + + TopoDS_Shape aResult = theShape; + double aTol = Precision::Confusion(); + + gp_Vec aVX = gp::DX(), aVZ = gp::DZ(); + + // Left reduction (rL, wL, ltransL, lthinL) + if (rL > aTol && wL > aTol && ltransL > aTol) { + gp_Pnt aPLeft (-l1, 0, 0); + gp_Ax2 anAxesLeft (aPLeft, -aVX, aVZ); + TopoDS_Shape aReductionLeft = GEOMImpl_IAdvancedOperations::MakeThicknessReduction + (anAxesLeft, r1, w1, rL, wL, ltransL, lthinL, fuseReductions); + + if (fuseReductions) { + BRepAlgoAPI_Fuse fuseL (aResult, aReductionLeft); + if (!fuseL.IsDone()) + StdFail_NotDone::Raise("Cannot fuse Te with left reduction"); + aResult = fuseL.Shape(); + } + else { + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + B.Add(C, aResult); + B.Add(C, aReductionLeft); + aResult = C; + } + } + + // Right reduction + if (rR > aTol && wR > aTol && ltransR > aTol) { + gp_Pnt aPRight (l1, 0, 0); + gp_Ax2 anAxesRight (aPRight, aVX, aVZ); + TopoDS_Shape aReductionRight = GEOMImpl_IAdvancedOperations::MakeThicknessReduction + (anAxesRight, r1, w1, rR, wR, ltransR, lthinR, fuseReductions); + + if (fuseReductions) { + BRepAlgoAPI_Fuse fuseR (aResult, aReductionRight); + if (!fuseR.IsDone()) + StdFail_NotDone::Raise("Cannot fuse Te with right reduction"); + aResult = fuseR.Shape(); + } + else { + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + B.Add(C, aResult); + B.Add(C, aReductionRight); + aResult = C; + } + } + + // Incident reduction + if (rI > aTol && wI > aTol && ltransI > aTol) { + gp_Pnt aPInci (0, 0, l2); + gp_Ax2 anAxesInci (aPInci, aVZ, aVX); + TopoDS_Shape aReductionInci = GEOMImpl_IAdvancedOperations::MakeThicknessReduction + (anAxesInci, r2, w2, rI, wI, ltransI, lthinI, fuseReductions); + + if (fuseReductions) { + BRepAlgoAPI_Fuse fuseInci (aResult, aReductionInci); + if (!fuseInci.IsDone()) + StdFail_NotDone::Raise("Cannot fuse Te with incident reduction"); + aResult = fuseInci.Shape(); + } + else { + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + B.Add(C, aResult); + B.Add(C, aReductionInci); + aResult = C; + } + } + + // Get rid of extra compounds + TopTools_ListOfShape listShapeRes; + GEOMUtils::AddSimpleShapes(aResult, listShapeRes); + aResult = listShapeRes.First(); // useful for the case "fuseReductions == true" + + if (!fuseReductions && listShapeRes.Extent() > 1) { + // Simplify T-Shape compound (get rid of sub-compounds) and glue duplicated faces + BRep_Builder B; + TopoDS_Compound C; + B.MakeCompound(C); + + TopTools_ListIteratorOfListOfShape itSub (listShapeRes); + for (; itSub.More(); itSub.Next()) + B.Add(C, itSub.Value()); + + // GlueFaces + aResult = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True); + } + + return aResult; +} + +//======================================================================= +//function : MakeThicknessReduction +//purpose : Static method. Create one thickness reduction element. +//======================================================================= +TopoDS_Shape GEOMImpl_IAdvancedOperations::MakeThicknessReduction (gp_Ax2 theAxes, + const double R, const double W, + const double Rthin, const double Wthin, + const double Ltrans, const double Lthin, + bool fuse) +{ + double aTol = Precision::Confusion(); + if (Rthin < aTol || Wthin < aTol || Ltrans < aTol) { + StdFail_NotDone::Raise("Cannot build thickness reduction: too small values"); + } + bool isThinPart = (Lthin > aTol); + + // . + // W |\ + // . \ + // ^ \ '-----------------. + // |R \| | Wthin + // | '-----------------' + // v Rthin + // --.--.--.--.--.--.--.--.--.--.--.--.--> theAxes.Direction() + // Ltrans Lthin + + double RExt = R + W; + double RthinExt = Rthin + Wthin; + + gp_Dir aNormal = theAxes.Direction(); + gp_Dir anXDir = theAxes.XDirection(); + gp_Pnt aPntCyl (theAxes.Location().XYZ() + aNormal.XYZ()*Ltrans); + gp_Ax2 anAxesCyl (aPntCyl, aNormal, anXDir); + + // Build the transition part + BRepPrimAPI_MakeCone ConeExt (theAxes, RExt, RthinExt, Ltrans); + BRepPrimAPI_MakeCone ConeInt (theAxes, R, Rthin, Ltrans); + ConeExt.Build(); + ConeInt.Build(); + if (!ConeExt.IsDone() || !ConeInt.IsDone()) + StdFail_NotDone::Raise("Cannot build cones of thickness reduction"); + BRepAlgoAPI_Cut cut1 (ConeExt.Shape(), ConeInt.Shape()); + if (!cut1.IsDone()) + StdFail_NotDone::Raise("Coudn't build transition part of thickness reduction"); + TopoDS_Shape aReduction = cut1.Shape(); + + // Build the thin part, if required + TopoDS_Shape aThinPart; + if (isThinPart) { + BRepPrimAPI_MakeCylinder CExt (anAxesCyl, RthinExt, Lthin); + BRepPrimAPI_MakeCylinder CInt (anAxesCyl, Rthin, Lthin); + CExt.Build(); + CInt.Build(); + if (!CExt.IsDone() || !CInt.IsDone()) + StdFail_NotDone::Raise("Cannot build cylinders of thickness reduction"); + BRepAlgoAPI_Cut cut2 (CExt.Shape(), CInt.Shape()); + if (!cut2.IsDone()) + StdFail_NotDone::Raise("Coudn't build thin part of thickness reduction"); + aThinPart = cut2.Shape(); + } + + // Join parts + if (fuse) { + if (isThinPart) { + BRepAlgoAPI_Fuse fuse1 (aReduction, aThinPart); + if (!fuse1.IsDone()) + StdFail_NotDone::Raise("Cannot fuse parts of thickness reduction"); + aReduction = fuse1.Shape(); + } + } + else { + // Partition the reduction on blocks + gp_Ax3 anAxesPln1 (aPntCyl, theAxes.XDirection(), aNormal); + gp_Ax3 anAxesPln2 (aPntCyl, theAxes.YDirection(), aNormal); + gp_Pln aPln1 (anAxesPln1); + gp_Pln aPln2 (anAxesPln2); + double aSize = Ltrans + Lthin + R + Rthin + Wthin; // to guarantee enough size in all directions + TopoDS_Shape aTool1 = BRepBuilderAPI_MakeFace(aPln1, -aSize, +aSize, -aSize, +aSize).Shape(); + TopoDS_Shape aTool2 = BRepBuilderAPI_MakeFace(aPln2, -aSize, +aSize, -aSize, +aSize).Shape(); + + GEOMAlgo_Splitter PS; + PS.AddShape(aReduction); + if (isThinPart) + PS.AddShape(aThinPart); + PS.AddTool(aTool1); + PS.AddTool(aTool2); + PS.SetLimit(TopAbs_SOLID); + PS.Perform(); + + aReduction = PS.Shape(); + } + + return aReduction; +} + //============================================================================= /*! * MakePipeTShape @@ -1212,6 +1594,9 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Objec Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShape(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, bool theHexMesh) { MESSAGE("GEOMImpl_IAdvancedOperations::MakePipeTShape"); @@ -1226,7 +1611,7 @@ Handle(TColStd_HSequenceOfTransient) //Check if the function is set correctly if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL; - GEOMImpl_IPipeTShape aData(aFunction); + GEOMImpl_IPipeTShape aData (aFunction); aData.SetR1(theR1); aData.SetW1(theW1); @@ -1236,6 +1621,10 @@ Handle(TColStd_HSequenceOfTransient) aData.SetL2(theL2); aData.SetHexMesh(theHexMesh); + bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion(); + bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion(); + bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion(); + //Compute the resulting value try { #if OCC_VERSION_LARGE > 0x06010000 @@ -1245,28 +1634,40 @@ Handle(TColStd_HSequenceOfTransient) SetErrorCode("TShape driver failed"); return NULL; } + if (theHexMesh) { if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) return NULL; if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) return NULL; } - } catch (Standard_Failure) { + + if (isTRL || isTRR || isTRI) { + // Add thickness reduction elements + // at the three extremities: Left, Right and Incident + TopoDS_Shape aResShape = + MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + !theHexMesh); + aFunction->SetValue(aResShape); + } + } + catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; } - Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; aSeq->Append(aShape); if (theHexMesh) { - /* - * Get the groups: BEGIN - */ + // Get the groups try { - if (!MakeGroups(aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) + if (!MakeGroups(aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., 0., aSeq, gp_Trsf())) return NULL; } catch (Standard_Failure) { @@ -1274,38 +1675,43 @@ Handle(TColStd_HSequenceOfTransient) SetErrorCode(aFail->GetMessageString()); 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 + TCollection_AsciiString anEntry, aListRes("["); + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 1; + 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 - GEOM::TPythonDump(aFunction) - << "[" << aShape << "] = geompy.MakePipeTShape(" << theR1 << ", " << theW1 << ", " - << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theHexMesh << ")"; + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; } + aListRes.Trunc(aListRes.Length() - 2); + + GEOM::TPythonDump pd (aFunction); + + pd << aListRes.ToCString() << "] = geompy.MakePipeTShape(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " + << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theHexMesh; + + // thickness reduction + if (isTRL) + pd << ", theRL=" << theRL << ", theWL=" << theWL + << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL; + if (isTRR) + pd << ", theRR=" << theRR << ", theWR=" << theWR + << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR; + if (isTRI) + pd << ", theRI=" << theRI << ", theWI=" << theWI + << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI; + + pd << ")"; SetErrorCode(OK); @@ -1333,12 +1739,16 @@ Handle(TColStd_HSequenceOfTransient) */ //============================================================================= 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) +GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition + (double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, + bool theHexMesh, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3) { SetErrorCode(KO); //Add a new object @@ -1368,6 +1778,10 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1, double th aData.SetL2(theL2); aData.SetHexMesh(theHexMesh); + bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion(); + bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion(); + bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion(); + //Compute the resulting value try { #if OCC_VERSION_LARGE > 0x06010000 @@ -1377,19 +1791,32 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1, double th SetErrorCode("TShape driver failed"); return NULL; } - } catch (Standard_Failure) { + + if (theHexMesh) { + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) + return NULL; + } + + if (isTRL || isTRR || isTRI) { + // Add thickness reduction elements + // at the three extremities: Left, Right and Incident + TopoDS_Shape aResShape = + MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + !theHexMesh); + aFunction->SetValue(aResShape); + } + } + catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; } - if (theHexMesh) { - if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) - return NULL; - if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) - return NULL; - } - TopoDS_Shape Te = aShape->GetValue(); // Set Position @@ -1397,15 +1824,15 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1, double th 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 - // + // Get the groups try { - if (!MakeGroups(aShape,TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) { + if (!MakeGroups(aShape,TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., 0., aSeq, aTrsf)) { return NULL; } } @@ -1414,40 +1841,43 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1, double th SetErrorCode(aFail->GetMessageString()); 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 + TCollection_AsciiString anEntry, aListRes("["); + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 1; + 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 - GEOM::TPythonDump(aFunction) - << "[" << aShape << "] = geompy.MakePipeTShape(" << theR1 << ", " << theW1 << ", " - << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theHexMesh << ", " << theP1 - << ", " << theP2 << ", " << theP3 << ")"; + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; } + aListRes.Trunc(aListRes.Length() - 2); + + GEOM::TPythonDump pd (aFunction); + + pd << aListRes.ToCString() << "] = geompy.MakePipeTShape(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " + << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3; + + // thickness reduction + if (isTRL) + pd << ", theRL=" << theRL << ", theWL=" << theWL + << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL; + if (isTRR) + pd << ", theRR=" << theRR << ", theWR=" << theWR + << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR; + if (isTRI) + pd << ", theRI=" << theRI << ", theWI=" << theWI + << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI; + + pd << ")"; SetErrorCode(OK); @@ -1474,10 +1904,14 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1, double th */ //============================================================================= Handle(TColStd_HSequenceOfTransient) -GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1, double theL1, - double theR2, double theW2, double theL2, - double theH, double theW, - bool theHexMesh) +GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer + (double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, + double theH, double theW, + bool theHexMesh) { SetErrorCode(KO); //Add a new object @@ -1501,6 +1935,10 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1, aData.SetW(theW); aData.SetHexMesh(theHexMesh); + bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion(); + bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion(); + bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion(); + //Compute the resulting value try { #if OCC_VERSION_LARGE > 0x06010000 @@ -1510,7 +1948,8 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1, SetErrorCode("TShape driver failed"); return NULL; } - } catch (Standard_Failure) { + } + catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; @@ -1578,39 +2017,43 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1, aFunction->SetValue(aChamferShape); // END of chamfer - // bool doMesh = false; if (theHexMesh) { - // doMesh = true; - if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false)) { - MESSAGE("PipeTShape partition failed"); - // doMesh = false; + if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false)) return NULL; - } - if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) { - MESSAGE("PipeTShape mirrors and glue failed"); - // doMesh = false; + if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2)) return NULL; + } + + // Add thickness reduction elements + // at the three extremities: Left, Right and Incident + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (isTRL || isTRR || isTRI) { + TopoDS_Shape aResShape = + MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + !theHexMesh); + aFunction->SetValue(aResShape); } } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; aSeq->Append(aShape); - // if (doMesh) { if (theHexMesh) { - // - // Get the groups: BEGIN - // - //if (!MakeGroups(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 << ")"; - //} - //else { + // Get the groups try { - if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) + if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, + theH, theW, 0., aSeq, gp_Trsf())) return NULL; } catch (Standard_Failure) { @@ -1618,40 +2061,43 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1, SetErrorCode(aFail->GetMessageString()); 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 << ")"; - //} } - // - // Get the groups: END - // - else { + + //Make a Python command + TCollection_AsciiString anEntry, aListRes("["); + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 1; + 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 - GEOM::TPythonDump(aFunction) - << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 - << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW - << ", " << theHexMesh << ")"; + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; } + aListRes.Trunc(aListRes.Length() - 2); + + GEOM::TPythonDump pd (aFunction); + + pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeChamfer(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " + << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theH << ", " << theW << ", " << theHexMesh; + + // thickness reduction + if (isTRL) + pd << ", theRL=" << theRL << ", theWL=" << theWL + << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL; + if (isTRR) + pd << ", theRR=" << theRR << ", theWR=" << theWR + << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR; + if (isTRI) + pd << ", theRI=" << theRI << ", theWI=" << theWI + << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI; + + pd << ")"; SetErrorCode(OK); @@ -1682,13 +2128,17 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1, */ //============================================================================= 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) +GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition + (double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, + double theH, double theW, + bool theHexMesh, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3) { SetErrorCode(KO); //Add a new object @@ -1717,6 +2167,10 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1, do aData.SetW(theW); aData.SetHexMesh(theHexMesh); + bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion(); + bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion(); + bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion(); + //Compute the resulting value try { #if OCC_VERSION_LARGE > 0x06010000 @@ -1726,7 +2180,8 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1, do SetErrorCode("TShape driver failed"); return NULL; } - } catch (Standard_Failure) { + } + catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; @@ -1799,21 +2254,42 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1, do return NULL; } - TopoDS_Shape Te = aShape->GetValue(); + // Add thickness reduction elements + // at the three extremities: Left, Right and Incident + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (isTRL || isTRR || isTRI) { + TopoDS_Shape aResShape = + MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + !theHexMesh); + aFunction->SetValue(aResShape); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } // Set Position gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3); - BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False); + BRepBuilderAPI_Transform aTransformation (aShape->GetValue(), 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 - */ + // Get the groups try { - if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) + if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, + theH, theW, 0., aSeq, aTrsf)) return NULL; } catch (Standard_Failure) { @@ -1821,40 +2297,44 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1, do SetErrorCode(aFail->GetMessageString()); 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 + TCollection_AsciiString anEntry, aListRes("["); + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 1; + 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 - GEOM::TPythonDump(aFunction) - << "[" << aShape << "] = geompy.MakePipeTShapeChamfer(" << theR1 << ", " << theW1 - << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theH << ", " << theW - << ", " << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")"; + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; } + aListRes.Trunc(aListRes.Length() - 2); + + GEOM::TPythonDump pd (aFunction); + + pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeChamfer(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " + << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theH << ", " << theW << ", " << theHexMesh << ", " + << theP1 << ", " << theP2 << ", " << theP3; + + // thickness reduction + if (isTRL) + pd << ", theRL=" << theRL << ", theWL=" << theWL + << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL; + if (isTRR) + pd << ", theRR=" << theRR << ", theWR=" << theWR + << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR; + if (isTRI) + pd << ", theRI=" << theRI << ", theWI=" << theWI + << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI; + + pd << ")"; SetErrorCode(OK); @@ -1880,9 +2360,13 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1, do */ //============================================================================= Handle(TColStd_HSequenceOfTransient) -GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, double theL1, - double theR2, double theW2, double theL2, - double theRF, bool theHexMesh) +GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet + (double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, + double theRF, bool theHexMesh) { SetErrorCode(KO); //Add a new object @@ -1905,6 +2389,10 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, d aData.SetRF(theRF); aData.SetHexMesh(theHexMesh); + bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion(); + bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion(); + bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion(); + //Compute the resulting value try { #if OCC_VERSION_LARGE > 0x06010000 @@ -1914,7 +2402,8 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, d SetErrorCode("TShape driver failed"); return NULL; } - } catch (Standard_Failure) { + } + catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; @@ -2003,14 +2492,36 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, d return NULL; } + // Add thickness reduction elements + // at the three extremities: Left, Right and Incident + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (isTRL || isTRR || isTRI) { + TopoDS_Shape aResShape = + MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + !theHexMesh); + aFunction->SetValue(aResShape); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient; aSeq->Append(aShape); + if (theHexMesh) { - /* - * Get the groups: BEGIN - */ + // Get the groups try { - if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf())) + if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., theRF, aSeq, gp_Trsf())) return NULL; } catch (Standard_Failure) { @@ -2018,39 +2529,43 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, d SetErrorCode(aFail->GetMessageString()); 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 + TCollection_AsciiString anEntry, aListRes("["); + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 1; + 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 - GEOM::TPythonDump(aFunction) - << "[" << aShape << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 - << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " - << theHexMesh << ")"; + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; } + aListRes.Trunc(aListRes.Length() - 2); + + GEOM::TPythonDump pd (aFunction); + + pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeFillet(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " + << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theRF << ", " << theHexMesh; + + // thickness reduction + if (isTRL) + pd << ", theRL=" << theRL << ", theWL=" << theWL + << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL; + if (isTRR) + pd << ", theRR=" << theRR << ", theWR=" << theWR + << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR; + if (isTRI) + pd << ", theRI=" << theRI << ", theWI=" << theWI + << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI; + + pd << ")"; SetErrorCode(OK); @@ -2080,12 +2595,16 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, d */ //============================================================================= 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) +GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition + (double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, + double theRF, bool theHexMesh, + Handle(GEOM_Object) theP1, + Handle(GEOM_Object) theP2, + Handle(GEOM_Object) theP3) { SetErrorCode(KO); //Add a new object @@ -2113,6 +2632,10 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou aData.SetRF(theRF); aData.SetHexMesh(theHexMesh); + bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion(); + bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion(); + bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion(); + //Compute the resulting value try { #if OCC_VERSION_LARGE > 0x06010000 @@ -2122,7 +2645,8 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou SetErrorCode("TShape driver failed"); return NULL; } - } catch (Standard_Failure) { + } + catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); return NULL; @@ -2210,21 +2734,42 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou return NULL; } - TopoDS_Shape Te = aShape->GetValue(); + // Add thickness reduction elements + // at the three extremities: Left, Right and Incident + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (isTRL || isTRR || isTRI) { + TopoDS_Shape aResShape = + MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + !theHexMesh); + aFunction->SetValue(aResShape); + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } // Set Position gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3); - BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False); + BRepBuilderAPI_Transform aTransformation (aShape->GetValue(), 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 - */ + // Get the groups try { - if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) + if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., theRF, aSeq, aTrsf)) return NULL; } catch (Standard_Failure) { @@ -2232,40 +2777,44 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou SetErrorCode(aFail->GetMessageString()); 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 + TCollection_AsciiString anEntry, aListRes("["); + // Iterate over the sequence aSeq + Standard_Integer aNbGroups = aSeq->Length(); + Standard_Integer i = 1; + 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 - GEOM::TPythonDump(aFunction) - << "[" << aShape << "] = geompy.MakePipeTShapeFillet(" << theR1 << ", " << theW1 - << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theRF << ", " - << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3 << ")"; - } + TDF_Tool::Entry(aGroup->GetEntry(), anEntry); + aListRes += anEntry + ", "; + } + aListRes.Trunc(aListRes.Length() - 2); + + GEOM::TPythonDump pd (aFunction); + + pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeFillet(" + << theR1 << ", " << theW1 << ", " << theL1 << ", " + << theR2 << ", " << theW2 << ", " << theL2 << ", " + << theRF << ", " << theHexMesh << ", " + << theP1 << ", " << theP2 << ", " << theP3; + + // thickness reduction + if (isTRL) + pd << ", theRL=" << theRL << ", theWL=" << theWL + << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL; + if (isTRR) + pd << ", theRR=" << theRR << ", theWR=" << theWR + << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR; + if (isTRI) + pd << ", theRI=" << theRI << ", theWI=" << theWI + << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI; + + pd << ")"; SetErrorCode(OK); diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx index a7c11d6ff..5611824cb 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.hxx @@ -27,6 +27,8 @@ #include "GEOM_Engine.hxx" #include "GEOM_Object.hxx" +#include + class GEOMImpl_IBasicOperations; class GEOMImpl_IBooleanOperations; class GEOMImpl_IShapesOperations; @@ -43,23 +45,36 @@ private: double theR2, double theW2, double theL2, double theH = 0, double theW = 0, double theRF = 0, bool isNormal = true); + bool MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape, double theR1, double theW1, double theL1, double theR2, double theW2, double theL2); + + bool MakePipeTShapeThicknessReduction (Handle(GEOM_Object) theShape, + double theR1, double theW1, double theL1, + double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI); + bool MakeGroups(Handle(GEOM_Object) theShape, int shapType, double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theH, double theW, double theRF, Handle(TColStd_HSequenceOfTransient) theSeq, gp_Trsf aTrsf); + gp_Trsf GetPositionTrsf(double theL1, double theL2, Handle(GEOM_Object) P1 = 0, Handle(GEOM_Object) P2 = 0, Handle(GEOM_Object) P3 = 0); + bool CheckCompatiblePosition(double& theL1, double& theL2, Handle(GEOM_Object) theP1, Handle(GEOM_Object) theP2, Handle(GEOM_Object) theP3, double theTolerance); + private: GEOMImpl_IBasicOperations* myBasicOperations; GEOMImpl_IBooleanOperations* myBooleanOperations; @@ -70,6 +85,57 @@ private: GEOMImpl_ILocalOperations* myLocalOperations; GEOMImpl_IHealingOperations* myHealingOperations; +public: + + /*! + * \brief Add three thickness reductions at the open ends of the pipe T-Shape + * + * \param theShape - the pipe T-Shape + * \param r1 - the internal radius of main pipe + * \param w1 - the thickness of main pipe + * \param l1 - the half-length of main pipe + * \param r2 - the internal radius of incident pipe + * \param w2 - the thickness of incident pipe + * \param l2 - the half-length of main pipe + * \param r*, w*, ltrans* and lthin* - internal radius, thickness, length of transition part + * and length of thin part of left(L), right(R) and + * incident(I) thickness reduction correspondingly + * \param fuseReductions - boolean flag (use true to generate single solid, + * false to obtain parts, useful for hexameshing) + * \retval TopoDS_Shape - Resulting shape + */ + Standard_EXPORT static TopoDS_Shape MakePipeTShapeThicknessReduction + (TopoDS_Shape theShape, + double r1, double w1, double l1, + double r2, double w2, double l2, + double rL, double wL, double ltransL, double lthinL, + double rR, double wR, double ltransR, double lthinR, + double rI, double wI, double ltransI, double lthinI, + bool fuseReductions); + + /*! + * \brief Create one thickness reduction element + * + * This method is called three times from MakePipeTShapeThicknessReduction + * to create three thickness reductions (one per each open end of a pipe T-Shape) + * + * \param theAxes - the position + * \param R - the internal radius of main pipe + * \param W - the thickness of main pipe + * \param Rthin - the internal radius of thin part + * \param Wthin - the thickness of thin part + * \param Ltrans - the length of transition part + * \param Lthin - the length of thin part + * \param fuse - boolean flag (use true to generate single solid, + * false to obtain parts, useful for hexameshing) + * \retval TopoDS_Shape - Resulting shape + */ + Standard_EXPORT static TopoDS_Shape MakeThicknessReduction (gp_Ax2 theAxes, + const double R, const double W, + const double Rthin, const double Wthin, + const double Ltrans, const double Lthin, + bool fuse); + public: Standard_EXPORT GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID); Standard_EXPORT ~GEOMImpl_IAdvancedOperations(); @@ -77,34 +143,57 @@ public: Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeTShape(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, bool theHexMesh = true); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeTShapeWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, bool theHexMesh = true, Handle(GEOM_Object) P1 = 0, Handle(GEOM_Object) P2 = 0, Handle(GEOM_Object) P3 = 0); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeTShapeChamfer(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, 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, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, bool theHexMesh = true, Handle(GEOM_Object) P1 = 0, Handle(GEOM_Object) P2 = 0, Handle(GEOM_Object) P3 = 0); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeTShapeFillet(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, double theRF, bool theHexMesh = true); + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2, + double theRL, double theWL, double theLtransL, double theLthinL, + double theRR, double theWR, double theLtransR, double theLthinR, + double theRI, double theWI, double theLtransI, double theLthinI, double theRF, bool theHexMesh = true, Handle(GEOM_Object) P1 = 0, Handle(GEOM_Object) P2 = 0, diff --git a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx index 65b2ea018..27d432337 100644 --- a/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBlocksOperations.cxx @@ -794,71 +794,14 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetEdgeNearPoint #if OCC_VERSION_LARGE > 0x06010000 OCC_CATCH_SIGNALS; #endif - TopoDS_Shape aShape; - TopoDS_Vertex aVert = TopoDS::Vertex(anArg); + TopoDS_Shape aShape = GEOMUtils::GetEdgeNearPoint(aBlockOrComp, aVert); - // 1. Explode blocks on edges - TopTools_MapOfShape mapShape; - Standard_Integer nbEdges = 0; - TopExp_Explorer exp (aBlockOrComp, TopAbs_EDGE); - for (; exp.More(); exp.Next()) { - if (mapShape.Add(exp.Current())) { - nbEdges++; - } - } - - if (nbEdges == 0) { - SetErrorCode("Given shape contains no edges"); - return NULL; - } - - mapShape.Clear(); - Standard_Integer ind = 1; - TopTools_Array1OfShape anEdges (1, nbEdges); - TColStd_Array1OfReal aDistances (1, nbEdges); - for (exp.Init(aBlockOrComp, TopAbs_EDGE); exp.More(); exp.Next()) { - if (mapShape.Add(exp.Current())) { - TopoDS_Shape anEdge = exp.Current(); - anEdges(ind) = anEdge; - - // 2. Classify the point relatively each edge - BRepExtrema_DistShapeShape aDistTool (aVert, anEdges(ind)); - if (!aDistTool.IsDone()) { - SetErrorCode("Can not find a distance from the given point to one of edges"); - return NULL; - } - aDistances(ind) = aDistTool.Value(); - ind++; - } - } - - // 3. Define edge, having minimum distance to the point - Standard_Real nearest = RealLast(), nbFound = 0; - Standard_Real prec = Precision::Confusion(); - for (ind = 1; ind <= nbEdges; ind++) { - if (Abs(aDistances(ind) - nearest) < prec) { - nbFound++; - } else if (aDistances(ind) < nearest) { - nearest = aDistances(ind); - aShape = anEdges(ind); - nbFound = 1; - } else { - } - } - if (nbFound > 1) { - SetErrorCode("Multiple edges near the given point are found"); - return NULL; - } else if (nbFound == 0) { - SetErrorCode("There are no edges near the given point"); - return NULL; - } else { - TopTools_IndexedMapOfShape anIndices; - TopExp::MapShapes(aBlockOrComp, anIndices); - Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); - anArray->SetValue(1, anIndices.FindIndex(aShape)); - aResult = GetEngine()->AddSubShape(theShape, anArray); - } + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aBlockOrComp, anIndices); + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); + anArray->SetValue(1, anIndices.FindIndex(aShape)); + aResult = GetEngine()->AddSubShape(theShape, anArray); } catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); diff --git a/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx b/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx index 8048d0313..981280427 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeTShape.hxx @@ -15,34 +15,13 @@ // 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 +#include class GEOMImpl_IPipeTShape { @@ -88,6 +67,34 @@ public: void SetP3(const Handle(GEOM_Function)& theP3){_func->SetReference(TSHAPE_ARG_P3, theP3); } Handle(GEOM_Function) GetP3() { return _func->GetReference(TSHAPE_ARG_P3); } +private: + enum { + // main pipe + TSHAPE_ARG_R1 = 1, + TSHAPE_ARG_W1 = 2, + TSHAPE_ARG_L1 = 3, + + // incident pipe + TSHAPE_ARG_R2 = 4, + TSHAPE_ARG_W2 = 5, + TSHAPE_ARG_L2 = 6, + + // chamfer + TSHAPE_ARG_H = 7, + TSHAPE_ARG_W = 8, + + // fillet + TSHAPE_ARG_RF = 9, + + // partition + TSHAPE_ARG_HEXMESH = 10, + + // junction points + TSHAPE_ARG_P1 = 11, + TSHAPE_ARG_P2 = 12, + TSHAPE_ARG_P3 = 13 + }; + private: Handle(GEOM_Function) _func; }; diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx index f28ff1f27..700c1163c 100644 --- a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,7 @@ #include #include +#include #include #include #include @@ -251,19 +253,19 @@ Handle(TColStd_HSequenceOfInteger) // along OX and OZ //======================================================================= void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& theShape, - TopAbs_ShapeEnum theShapeType, - double r1, - double r2, - Handle(TopTools_HSequenceOfShape)& commonShapes) const + 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); + gp_Ax3 anAxis1 (aP0, aVX, aVZ), anAxis2 (aP0, aVZ, aVX); TopTools_IndexedMapOfShape aMapOfShapes; aMapOfShapes.Clear(); TopExp::MapShapes(theShape, aMapOfShapes); - + commonShapes->Clear(); int myID; @@ -289,9 +291,9 @@ void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& t 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; + myID = aSeqExt1->Value(j); + commonShapes->Append(aMapOfShapes.FindKey(myID)); + found = true; } } } @@ -303,8 +305,8 @@ void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& t //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 +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; @@ -312,8 +314,8 @@ TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape(const double r1, const do 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); + gp_Ax2 anAxes1 (aP1, aVX, aVZ); + gp_Ax2 anAxes2 (aP0, aVZ, aVX); // Build the initial pipes BRepPrimAPI_MakeCylinder C1Int (anAxes1, r1, Abs(2 * l1)); @@ -325,13 +327,13 @@ TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape(const double r1, const do C2Int.Build(); C2Ext.Build(); if (!C1Int.IsDone() || !C1Ext.IsDone() || !C2Int.IsDone() || !C2Ext.IsDone()) { - StdFail_NotDone::Raise("Couldn't build cylinders"); + StdFail_NotDone::Raise("Cannot build cylinders"); } // Fuse the 2 pipes BRepAlgoAPI_Fuse fuse1 (C1Ext.Shape(), C2Ext.Shape()); if (!fuse1.IsDone()) { - StdFail_NotDone::Raise("Couldn't fuse cylinders"); + StdFail_NotDone::Raise("Cannot fuse cylinders"); } // Remove small radius main pipe @@ -353,17 +355,17 @@ TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape(const double r1, const do //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 +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))); + double r1Ext = r1 + w1; + 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()) { @@ -385,7 +387,7 @@ TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakeQuarterPipeTShape(const double r1, c //function : Execute //purpose : //======================================================================= -Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) const +Standard_Integer GEOMImpl_PipeTShapeDriver::Execute (TFunction_Logbook& log) const { if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); @@ -394,20 +396,20 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons Standard_Integer aType = aFunction->GetType(); TopoDS_Shape aShape, Te4, Te4Part; -// TopoDS_Edge arete_intersect_int; -// Handle(TopTools_HSequenceOfShape) edges_e = new TopTools_HSequenceOfShape; + //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(); + //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 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) { StdFail_NotDone::Raise("TShape cannot be computed if R2 > R1"); } @@ -415,7 +417,7 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons if (aR2Ext > aR1Ext + epsilon) { 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) @@ -428,11 +430,10 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons } } - if (aR1Ext >= aData.GetL2() + epsilon) { StdFail_NotDone::Raise("TShape cannot be computed if R1+W1 >= L2"); } - if (aR2Ext >= aData.GetL1() + epsilon) { + if (aR2Ext >= aData.GetL1() + epsilon) { StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 >= L1"); } @@ -446,22 +447,22 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons } if (aType == TSHAPE_FILLET) { - if (aData.GetRF() >= (aData.GetL2() - aR1Ext + epsilon) || - aData.GetRF() >= (aData.GetL1() - aR2Ext + epsilon)) + 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; + //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()); + aData.GetR2(), aData.GetW2(), aData.GetL2()); } else { // No need to cut pipe t-shape -// std::cerr << "Create a basic T-Shape pipe" << std::endl; + //std::cerr << "Create a basic T-Shape pipe" << std::endl; Te4 = MakePipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(), - aData.GetR2(), aData.GetW2(), aData.GetL2()); + aData.GetR2(), aData.GetW2(), aData.GetL2()); } aShape = Te4; /* @@ -502,7 +503,6 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons 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); @@ -547,10 +547,9 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons 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(); } @@ -558,10 +557,10 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons // 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)); @@ -584,7 +583,7 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) cons 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++) { diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx index 90d8f35ec..19196fedf 100644 --- a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx @@ -15,7 +15,6 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// #ifndef _GEOMImpl_PipeTShapeDriver_HXX #define _GEOMImpl_PipeTShapeDriver_HXX @@ -24,11 +23,12 @@ #include "GEOMAlgo_State.hxx" +#include #include #include #include -#include #include +#include #include @@ -125,32 +125,33 @@ public: 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 w1 - the thickness of 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 w2 - the thickness of 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; + 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 w1 - the thickness of 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 w2 - the thickness of 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; + TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1, + double r2, double w2, double l2) const; -//======================================================================= -//function : GetShapesOnSurfaceIDs /*! * \brief Find IDs of sub-shapes complying with given status about surface * \param theSurface - the surface to check state of sub-shapes against @@ -164,8 +165,7 @@ private: const TopoDS_Shape& theShape, TopAbs_ShapeEnum theShapeType, GEOMAlgo_State theState) const; -//======================================================================= -//function : getShapesOnBoxIDs + /*! * \brief Find IDs of sub-shapes complying with given status about surface * \param theBox - the box to check state of sub-shapes against @@ -174,7 +174,6 @@ private: * \param theState - required state * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes */ -//======================================================================= Handle(TColStd_HSequenceOfInteger) GetShapesOnBoxIDs(const TopoDS_Shape& aBox, const TopoDS_Shape& aShape, @@ -188,7 +187,7 @@ private: //======================================================================= void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape, TopAbs_ShapeEnum theShapeType, - double r, double r2, + double r, double r2, Handle(TopTools_HSequenceOfShape)& commonShapes) const; }; diff --git a/src/GEOMUtils/GEOMUtils.cxx b/src/GEOMUtils/GEOMUtils.cxx index 292ab5c44..0b02a04a6 100644 --- a/src/GEOMUtils/GEOMUtils.cxx +++ b/src/GEOMUtils/GEOMUtils.cxx @@ -32,6 +32,8 @@ // OCCT Includes #include +#include + #include #include #include @@ -53,6 +55,7 @@ #include #include #include +#include #include #include @@ -63,6 +66,8 @@ #include #include +#include + #include #include @@ -427,6 +432,34 @@ TopoDS_Shape GEOMUtils::CompsolidToCompound (const TopoDS_Shape& theCompsolid) return aCompound; } +//======================================================================= +//function : AddSimpleShapes +//purpose : +//======================================================================= +void GEOMUtils::AddSimpleShapes (const TopoDS_Shape& theShape, TopTools_ListOfShape& theList) +{ + if (theShape.ShapeType() != TopAbs_COMPOUND && + theShape.ShapeType() != TopAbs_COMPSOLID) { + theList.Append(theShape); + return; + } + + TopTools_MapOfShape mapShape; + TopoDS_Iterator It (theShape, Standard_True, Standard_True); + + for (; It.More(); It.Next()) { + TopoDS_Shape aShape_i = It.Value(); + if (mapShape.Add(aShape_i)) { + if (aShape_i.ShapeType() == TopAbs_COMPOUND || + aShape_i.ShapeType() == TopAbs_COMPSOLID) { + AddSimpleShapes(aShape_i, theList); + } else { + theList.Append(aShape_i); + } + } + } +} + //======================================================================= //function : CheckTriangulation //purpose : @@ -497,3 +530,71 @@ TopAbs_ShapeEnum GEOMUtils::GetTypeOfSimplePart (const TopoDS_Shape& theShape) } return TopAbs_SHAPE; } + +//======================================================================= +//function : GetEdgeNearPoint +//purpose : +//======================================================================= +TopoDS_Shape GEOMUtils::GetEdgeNearPoint (const TopoDS_Shape& theShape, + const TopoDS_Vertex& thePoint) +{ + TopoDS_Shape aResult; + + // 1. Explode the shape on edges + TopTools_MapOfShape mapShape; + Standard_Integer nbEdges = 0; + TopExp_Explorer exp (theShape, TopAbs_EDGE); + for (; exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + nbEdges++; + } + } + + if (nbEdges == 0) + Standard_NullObject::Raise("Given shape contains no edges"); + + mapShape.Clear(); + Standard_Integer ind = 1; + TopTools_Array1OfShape anEdges (1, nbEdges); + TColStd_Array1OfReal aDistances (1, nbEdges); + for (exp.Init(theShape, TopAbs_EDGE); exp.More(); exp.Next()) { + if (mapShape.Add(exp.Current())) { + TopoDS_Shape anEdge = exp.Current(); + anEdges(ind) = anEdge; + + // 2. Classify the point relatively each edge + BRepExtrema_DistShapeShape aDistTool (thePoint, anEdges(ind)); + if (!aDistTool.IsDone()) + Standard_ConstructionError::Raise("Cannot find a distance from the given point to one of edges"); + + aDistances(ind) = aDistTool.Value(); + ind++; + } + } + + // 3. Define edge, having minimum distance to the point + Standard_Real nearest = RealLast(), nbFound = 0; + Standard_Real prec = Precision::Confusion(); + for (ind = 1; ind <= nbEdges; ind++) { + if (Abs(aDistances(ind) - nearest) < prec) { + nbFound++; + } + else if (aDistances(ind) < nearest) { + nearest = aDistances(ind); + aResult = anEdges(ind); + nbFound = 1; + } + else { + } + } + if (nbFound > 1) { + Standard_ConstructionError::Raise("Multiple edges near the given point are found"); + } + else if (nbFound == 0) { + Standard_ConstructionError::Raise("There are no edges near the given point"); + } + else { + } + + return aResult; +} diff --git a/src/GEOMUtils/GEOMUtils.hxx b/src/GEOMUtils/GEOMUtils.hxx index d6b10816f..37e06bbf9 100644 --- a/src/GEOMUtils/GEOMUtils.hxx +++ b/src/GEOMUtils/GEOMUtils.hxx @@ -23,6 +23,7 @@ #define _GEOMUtils_HXX_ #include +#include #include @@ -89,6 +90,17 @@ class GEOMUtils { */ Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid); + /*! + * \brief Recursively extract all shapes from compounds and compsolids of the given shape into theList. + * + * If theShape is not compound or compsolid, theList will contain only theShape itself. + * + * \param theShape The shape to be exploded. + * \param theList Output parameter. + */ + Standard_EXPORT static void AddSimpleShapes (const TopoDS_Shape& theShape, + TopTools_ListOfShape& theList); + /*! * \brief Build a triangulation on \a theShape if it is absent. * \param theShape The shape to check/build triangulation on. @@ -103,6 +115,16 @@ class GEOMUtils { */ Standard_EXPORT static TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape); + /*! + * \brief Find an edge of theShape, closest to thePoint. + * + * \param theShape The shape to explore. + * \param thePoint The point near the required edge. + * \retval TopoDS_Shape Returns the found edge or an empty shape if multiple edges found. + */ + Standard_EXPORT static TopoDS_Shape GetEdgeNearPoint (const TopoDS_Shape& theShape, + const TopoDS_Vertex& thePoint); + }; #endif diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc index 77310827f..9897b9785 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc @@ -15,11 +15,10 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File : GEOM_IAdvancedOperations.cc // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #include #include "GEOM_IAdvancedOperations_i.hh" @@ -68,8 +67,10 @@ GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i() * \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* 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; @@ -77,10 +78,13 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, GetOperations()->SetNotDone(); //Create the TShape - Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh); + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., + 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++) @@ -109,9 +113,11 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, * \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* 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; @@ -125,10 +131,13 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::D 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); + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., + 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++) @@ -156,9 +165,10 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::D * \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* 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; @@ -166,10 +176,13 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double GetOperations()->SetNotDone(); //Create the TShape - Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh); + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., + 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++) @@ -201,10 +214,11 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double * \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* 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; @@ -217,11 +231,13 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (C 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); + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., + 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++) @@ -248,9 +264,10 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (C * \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* 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; @@ -258,10 +275,13 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double GetOperations()->SetNotDone(); //Create the TShape - Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh); + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., + 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++) @@ -292,10 +312,332 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double * \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* 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, + 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., + 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(); +} + +//============================================================================= +/*! + * MakePipeTShapeTR + * 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. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTR + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + 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, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + 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(); +} + +//============================================================================= +/*! + * MakePipeTShapeTRWithPosition + * 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 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. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + 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, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + 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(); +} + +//============================================================================= +/*! + * MakePipeTShapeTRChamfer + * 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 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. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRChamfer + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + 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, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + 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(); +} + +//============================================================================= +/*! + * MakePipeTShapeTRChamferWithPosition + * 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 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. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRChamferWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + 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, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + 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(); +} + +//============================================================================= +/*! + * MakePipeTShapeTRFillet + * 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. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRFillet + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + 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, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + 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(); +} + +//============================================================================= +/*! + * MakePipeTShapeTRFilletWithPosition + * 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 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. + */ +//============================================================================= +GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRFilletWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + 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; @@ -308,11 +650,15 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CO 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); + Handle(TColStd_HSequenceOfTransient) aHSeq = + GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + 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++) @@ -330,8 +676,8 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CO * \return New GEOM_Object, containing the created shape. */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, - CORBA::Double theRatio, +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR, + CORBA::Double theRatio, CORBA::Short theOrientation, GEOM::pattern thePattern) { @@ -353,7 +699,7 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double * MakeDividedDiskPntVecR */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt, +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec, CORBA::Double theR, CORBA::Double theRatio, @@ -387,7 +733,7 @@ GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM:: * \return New GEOM_Object, containing the created shape. */ //============================================================================= -GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Double theR, +GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH, GEOM::pattern thePattern) { diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh index fde5fcfa5..b341a9fed 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.hh +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.hh @@ -15,11 +15,10 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// // File : GEOM_IAdvancedOperations.hh // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com) -// + #ifndef _GEOM_IAdvancedOperations_i_HeaderFile #define _GEOM_IAdvancedOperations_i_HeaderFile @@ -39,43 +38,91 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i : { public: GEOM_IAdvancedOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, - ::GEOMImpl_IAdvancedOperations* theImpl); + ::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); - - GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, - CORBA::Double theRatio, + // PipeTShape without thickness reduction + 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); + + // PipeTShape with thickness reduction + GEOM::ListOfGO* MakePipeTShapeTR + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + CORBA::Boolean theHexMesh); + GEOM::ListOfGO* MakePipeTShapeTRWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + GEOM::ListOfGO* MakePipeTShapeTRChamfer + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh); + GEOM::ListOfGO* MakePipeTShapeTRChamferWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + 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* MakePipeTShapeTRFillet + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + CORBA::Double theRF, CORBA::Boolean theHexMesh); + GEOM::ListOfGO* MakePipeTShapeTRFilletWithPosition + (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1, + CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, + CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL, + CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR, + CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI, + CORBA::Double theRF, CORBA::Boolean theHexMesh, + GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3); + + GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR, + CORBA::Double theRatio, CORBA::Short theOrientation, GEOM::pattern thePattern); - + GEOM::GEOM_Object_ptr MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr theCenter, GEOM::GEOM_Object_ptr theVector, CORBA::Double theR, CORBA::Double theRatio, GEOM::pattern thePattern); - - GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, + + GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR, CORBA::Double theH, GEOM::pattern thePattern); /*@@ insert new functions before this line @@ do not remove this line @@*/ diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index a5959bf6e..937c2b27e 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -11514,16 +11514,34 @@ class geompyDC(GEOM._objref_GEOM_Gen): # The extremity of the incident pipe is located on junction point P3. # If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and # 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 (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 + # + # @param theRL Internal radius of left thickness reduction + # @param theWL Width of left thickness reduction + # @param theLtransL Length of left transition part + # @param theLthinL Length of left thin part + # + # @param theRR Internal radius of right thickness reduction + # @param theWR Width of right thickness reduction + # @param theLtransR Length of right transition part + # @param theLthinR Length of right thin part + # + # @param theRI Internal radius of incident thickness reduction + # @param theWI Width of incident thickness reduction + # @param theLtransI Length of incident transition part + # @param theLthinI Length of incident thin part + # # @param theName Object name; when specified, this parameter is used # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. @@ -11531,7 +11549,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return List of GEOM.GEOM_Object, containing the created shape and propagation groups. # # @ref tui_creation_pipetshape "Example" - def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None, theName=None): + def MakePipeTShape (self, theR1, theW1, theL1, theR2, theW2, theL2, + theHexMesh=True, theP1=None, theP2=None, theP3=None, + theRL=0, theWL=0, theLtransL=0, theLthinL=0, + theRR=0, theWR=0, theLtransR=0, theLthinR=0, + theRI=0, theWI=0, theLtransI=0, theLthinI=0, + theName=None): """ Create a T-shape object with specified caracteristics for the main and the incident pipes (radius, width, half-length). @@ -11540,7 +11563,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and the main plane of the T-shape is XOY. - Paremeters: + Parameters: theR1 Internal radius of main pipe theW1 Width of main pipe theL1 Half-length of main pipe @@ -11551,6 +11574,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): theP1 1st junction point of main pipe theP2 2nd junction point of main pipe theP3 Junction point of incident pipe + + theRL Internal radius of left thickness reduction + theWL Width of left thickness reduction + theLtransL Length of left transition part + theLthinL Length of left thin part + + theRR Internal radius of right thickness reduction + theWR Width of right thickness reduction + theLtransR Length of right transition part + theLthinR Length of right thin part + + theRI Internal radius of incident thickness reduction + theWI Width of incident thickness reduction + theLtransI Length of incident transition part + theLthinI Length of incident thin part + theName Object name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name. @@ -11563,12 +11602,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0) # create PipeTShape object with position pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3) + # create PipeTShape object with left thickness reduction + pipetshape_thr = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, theRL=60, theWL=20, theLtransL=40, theLthinL=20) """ - theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2) + theR1, theW1, theL1, theR2, theW2, theL2, theRL, theWL, theLtransL, theLthinL, theRR, theWR, theLtransR, theLthinR, theRI, theWI, theLtransI, theLthinI, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRL, theWL, theLtransL, theLthinL, theRR, theWR, theLtransR, theLthinR, theRI, theWI, theLtransI, theLthinI) if (theP1 and theP2 and theP3): - anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3) + anObj = self.AdvOp.MakePipeTShapeTRWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theHexMesh, theP1, theP2, theP3) else: - anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh) + anObj = self.AdvOp.MakePipeTShapeTR(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theHexMesh) RaiseIfFailed("MakePipeTShape", self.AdvOp) if Parameters: anObj[0].SetParameters(Parameters) def_names = [ "pipeTShape" ] + [ "pipeTShape_grp_%d" % i for i in range(1, len(anObj)) ] @@ -11594,6 +11643,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theP1 1st junction point of main pipe # @param theP2 2nd junction point of main pipe # @param theP3 Junction point of incident pipe + # + # @param theRL Internal radius of left thickness reduction + # @param theWL Width of left thickness reduction + # @param theLtransL Length of left transition part + # @param theLthinL Length of left thin part + # + # @param theRR Internal radius of right thickness reduction + # @param theWR Width of right thickness reduction + # @param theLtransR Length of right transition part + # @param theLthinR Length of right thin part + # + # @param theRI Internal radius of incident thickness reduction + # @param theWI Width of incident thickness reduction + # @param theLtransI Length of incident transition part + # @param theLthinI Length of incident thin part + # # @param theName Object name; when specified, this parameter is used # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. @@ -11601,7 +11666,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return List of GEOM.GEOM_Object, containing the created shape and propagation groups. # # @ref tui_creation_pipetshape "Example" - def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None, theName=None): + def MakePipeTShapeChamfer (self, theR1, theW1, theL1, theR2, theW2, theL2, + theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None, + theRL=0, theWL=0, theLtransL=0, theLthinL=0, + theRR=0, theWR=0, theLtransR=0, theLthinR=0, + theRI=0, theWI=0, theLtransI=0, theLthinI=0, + theName=None): """ Create a T-shape object with chamfer and with specified caracteristics for the main and the incident pipes (radius, width, half-length). The chamfer is @@ -11611,7 +11681,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and the main plane of the T-shape is XOY. - Paremeters: + Parameters: theR1 Internal radius of main pipe theW1 Width of main pipe theL1 Half-length of main pipe @@ -11624,6 +11694,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): theP1 1st junction point of main pipe theP2 2nd junction point of main pipe theP3 Junction point of incident pipe + + theRL Internal radius of left thickness reduction + theWL Width of left thickness reduction + theLtransL Length of left transition part + theLthinL Length of left thin part + + theRR Internal radius of right thickness reduction + theWR Width of right thickness reduction + theLtransR Length of right transition part + theLthinR Length of right thin part + + theRI Internal radius of incident thickness reduction + theWI Width of incident thickness reduction + theLtransI Length of incident transition part + theLthinI Length of incident thin part + theName Object name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name. @@ -11636,12 +11722,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0) # create PipeTShape with chamfer object with position pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3) + # create PipeTShape with chamfer object with left thickness reduction + pipetshapechamfer_thr = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, theRL=60, theWL=20, theLtransL=40, theLthinL=20) """ - theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW) + theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theRL, theWL, theLtransL, theLthinL, theRR, theWR, theLtransR, theLthinR, theRI, theWI, theLtransI, theLthinI, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theRL, theWL, theLtransL, theLthinL, theRR, theWR, theLtransR, theLthinR, theRI, theWI, theLtransI, theLthinI) if (theP1 and theP2 and theP3): - anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3) + anObj = self.AdvOp.MakePipeTShapeTRChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theH, theW, theHexMesh, theP1, theP2, theP3) else: - anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh) + anObj = self.AdvOp.MakePipeTShapeTRChamfer(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theH, theW, theHexMesh) RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp) if Parameters: anObj[0].SetParameters(Parameters) def_names = [ "pipeTShape" ] + [ "pipeTShape_grp_%d" % i for i in range(1, len(anObj)) ] @@ -11666,6 +11762,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theP1 1st junction point of main pipe # @param theP2 2nd junction point of main pipe # @param theP3 Junction point of incident pipe + # + # @param theRL Internal radius of left thickness reduction + # @param theWL Width of left thickness reduction + # @param theLtransL Length of left transition part + # @param theLthinL Length of left thin part + # + # @param theRR Internal radius of right thickness reduction + # @param theWR Width of right thickness reduction + # @param theLtransR Length of right transition part + # @param theLthinR Length of right thin part + # + # @param theRI Internal radius of incident thickness reduction + # @param theWI Width of incident thickness reduction + # @param theLtransI Length of incident transition part + # @param theLthinI Length of incident thin part + # # @param theName Object name; when specified, this parameter is used # for result publication in the study. Otherwise, if automatic # publication is switched on, default value is used for result name. @@ -11673,7 +11785,12 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @return List of GEOM.GEOM_Object, containing the created shape and propagation groups. # # @ref tui_creation_pipetshape "Example" - def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None, theName=None): + def MakePipeTShapeFillet (self, theR1, theW1, theL1, theR2, theW2, theL2, + theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None, + theRL=0, theWL=0, theLtransL=0, theLthinL=0, + theRR=0, theWR=0, theLtransR=0, theLthinR=0, + theRI=0, theWI=0, theLtransI=0, theLthinI=0, + theName=None): """ Create a T-shape object with fillet and with specified caracteristics for the main and the incident pipes (radius, width, half-length). The fillet is @@ -11681,7 +11798,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): 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. - Paremeters: + Parameters: If P1, P2 and P3 are not given, the center of the shape is (0,0,0) and the main plane of the T-shape is XOY. theR1 Internal radius of main pipe @@ -11695,6 +11812,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): theP1 1st junction point of main pipe theP2 2nd junction point of main pipe theP3 Junction point of incident pipe + + theRL Internal radius of left thickness reduction + theWL Width of left thickness reduction + theLtransL Length of left transition part + theLthinL Length of left thin part + + theRR Internal radius of right thickness reduction + theWR Width of right thickness reduction + theLtransR Length of right transition part + theLthinR Length of right thin part + + theRI Internal radius of incident thickness reduction + theWI Width of incident thickness reduction + theLtransI Length of incident transition part + theLthinI Length of incident thin part + theName Object name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic publication is switched on, default value is used for result name. @@ -11707,13 +11840,22 @@ class geompyDC(GEOM._objref_GEOM_Gen): pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0) # create PipeTShape with fillet object with position pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3) - + # create PipeTShape with fillet object with left thickness reduction + pipetshapefillet_thr = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, theRL=60, theWL=20, theLtransL=40, theLthinL=20) """ - theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF) + theR1, theW1, theL1, theR2, theW2, theL2, theRF, theRL, theWL, theLtransL, theLthinL, theRR, theWR, theLtransR, theLthinR, theRI, theWI, theLtransI, theLthinI, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theRL, theWL, theLtransL, theLthinL, theRR, theWR, theLtransR, theLthinR, theRI, theWI, theLtransI, theLthinI) if (theP1 and theP2 and theP3): - anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3) + anObj = self.AdvOp.MakePipeTShapeTRFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theRF, theHexMesh, theP1, theP2, theP3) else: - anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh) + anObj = self.AdvOp.MakePipeTShapeTRFillet(theR1, theW1, theL1, theR2, theW2, theL2, + theRL, theWL, theLtransL, theLthinL, + theRR, theWR, theLtransR, theLthinR, + theRI, theWI, theLtransI, theLthinI, + theRF, theHexMesh) RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp) if Parameters: anObj[0].SetParameters(Parameters) def_names = [ "pipeTShape" ] + [ "pipeTShape_grp_%d" % i for i in range(1, len(anObj)) ] @@ -11847,7 +11989,7 @@ class geompyDC(GEOM._objref_GEOM_Gen): """ Create a copy of the given object - Paremeters: + Parameters: theOriginal geometry object for copy theName Object name; when specified, this parameter is used for result publication in the study. Otherwise, if automatic