From: gdd Date: Mon, 19 Apr 2010 18:06:39 +0000 (+0000) Subject: 0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape X-Git-Tag: V5_1_4rc1~37 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d50477335ff2a466b6992785fc65bd7c6e43799;p=modules%2Fgeom.git 0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape - Fix problem with group creation for pipe t-shapes with position - Update documentation --- diff --git a/doc/salome/gui/GEOM/images/pipetshape.png b/doc/salome/gui/GEOM/images/pipetshape.png new file mode 100644 index 000000000..af7540c44 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshape.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshape_dlg.png b/doc/salome/gui/GEOM/images/pipetshape_dlg.png new file mode 100644 index 000000000..d4b51d255 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshape_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshapechamfer.png b/doc/salome/gui/GEOM/images/pipetshapechamfer.png new file mode 100644 index 000000000..6ec7b2e9f Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshapechamfer.png differ diff --git a/doc/salome/gui/GEOM/images/pipetshapefillet.png b/doc/salome/gui/GEOM/images/pipetshapefillet.png new file mode 100644 index 000000000..b1cf14061 Binary files /dev/null and b/doc/salome/gui/GEOM/images/pipetshapefillet.png differ diff --git a/doc/salome/gui/GEOM/input/creating_adv_obj.doc b/doc/salome/gui/GEOM/input/creating_adv_obj.doc index 93dcc5dfa..69a9a9eb1 100644 --- a/doc/salome/gui/GEOM/input/creating_adv_obj.doc +++ b/doc/salome/gui/GEOM/input/creating_adv_obj.doc @@ -17,6 +17,7 @@ entities: New Entity -> Advanced submenu allows to create additional complex topological objects. diff --git a/doc/salome/gui/GEOM/input/creating_pipetshape.doc b/doc/salome/gui/GEOM/input/creating_pipetshape.doc new file mode 100644 index 000000000..823bc3eb9 --- /dev/null +++ b/doc/salome/gui/GEOM/input/creating_pipetshape.doc @@ -0,0 +1,58 @@ +/*! + +\page create_pipetshape_page PipeTShape + +To create a \b PipeTShape in the Main Menu select New Entity - > +Advanced - > PipeTShape + +Specify the parameters of the PipeTShape object creation in the opened dialog +box and press "Apply" or "Apply & Close" button. +Result of each operation will be a GEOM_Object. + +TUI Command: geompy.MakePipeTShape(R1, W1, L1, R2, W2, L2, HexMesh=True, P1=None, P2=None, P3=None) + +Arguments: +- \b R1 - Radius of main T-shape pipe. +- \b W1 - Thickness of main T-shape pipe. +- \b L1 - Length of main T-shape pipe. +- \b R2 - Radius of incident T-shape pipe. +- \b W2 - Thickness of incident T-shape pipe. +- \b L2 - Length of incident T-shape pipe. +- \b HexMesh - If True, the shape is splitted in blocks (suitable for hexaedral mesh). +- \b P1 - First junction point of main pipe (GEOM Vertex). +- \b P2 - Second junction point of main pipe (GEOM Vertex). +- \b P3 - Junction point of incident pipe (GEOM Vertex). + +\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: + +TUI Command: geompy.MakePipeTShapeChamfer(R1, W1, L1, R2, W2, L2, H, W, HexMesh=True, P1=None, P2=None, P3=None) + +Arguments are the same as normal Pipe T-Shape plus: +- \b H - Height of the chamfer along incident pipe. +- \b W - Width of the chamfer along the main pipe. + +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: + +TUI Command: geompy.MakePipeTShapeFillet(R1, W1, L1, R2, W2, L2, RF, HexMesh=True, P1=None, P2=None, P3=None) + +Arguments are the same as normal Pipe T-Shape plus: +- \b RF - Radius of the fillet. + +Example: + +\image html pipetshapefillet.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/input/tui_advanced_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc index 818742073..724b2da43 100644 --- a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc @@ -218,5 +218,83 @@ id_compound = geompy.addToStudy(compound,"Compound") gg.createAndDisplayGO(id_compound) \endcode +\anchor tui_creation_pipetshape +

Creation of PipeTShape

+ +\code +import geompy +import salome +gg = salome.ImportComponentGUI("GEOM") + +# create PipeTShape object +pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0) + +# add object in the study +id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape") +# add groups in the study +for g in pipetshape[1:]: + geompy.addToStudyInFather(pipetshape[0], g, g.GetName()) + +# Create junction vertices +P1 = geompy.MakeVertex(0.0, 0.0, 0.0) +P2 = geompy.MakeVertex(400.0, 0.0, 0.0) +P3 = geompy.MakeVertex(200.0, 0.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) + +# add object in the study +id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position") +# add groups in the study +for g in pipetshape_position[1:]: + geompy.addToStudyInFather(pipetshape_position[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) + +# add object in the study +id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer") +# add groups in the study +for g in pipetshapechamfer[1:]: + geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName()) + +# 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) + +# add object in the study +id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position") +# add groups in the study +for g in pipetshapechamfer_position[1:]: + geompy.addToStudyInFather(pipetshapechamfer_position[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) + +# add object in the study +id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet") +# add groups in the study +for g in pipetshapefillet[1:]: + geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName()) + +# 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) + +# add object in the study +id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position") +# add groups in the study +for g in pipetshapefillet_position[1:]: + geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName()) + + +# display pipetshapes +gg.createAndDisplayGO(id_pipetshape) +gg.createAndDisplayGO(id_pipetshape_position) +gg.createAndDisplayGO(id_pipetshapechamfer) +gg.createAndDisplayGO(id_pipetshapechamfer_position) +gg.createAndDisplayGO(id_pipetshapefillet) +gg.createAndDisplayGO(id_pipetshapefillet_position) + +\endcode + */ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 02c2e4690..ed22e1e18 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -3162,26 +3162,24 @@ module GEOM * \param theR2 Internal radius of incident pipe (R2 < R1) * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe - * \param theHexMesh false = no partition, true = with partition + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) * \return List of GEOM_Objects, containing the created shape and propagation groups. */ ListOfGO MakePipeTShape (in double theR1, in double theW1, in double theL1, in double theR2, in double theW2, in double theL2, in boolean theHexMesh); - /*! * Create a T-shape object with specified caracteristics for the main and * the incident pipes (radius, width, half-length). * The extremities of the main pipe are located on junctions points P1 and P2. * The extremity of the incident pipe is located on junction point P3. - * * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe * \param theL1 Half-length of main pipe * \param theR2 Internal radius of incident pipe (R2 < R1) * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe - * \param theHexMesh false = no partition, true = with partition + * \param 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 @@ -3191,13 +3189,11 @@ module GEOM in double theR2, in double theW2, in double theL2, in boolean theHexMesh, in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); - /*! * Create a T-shape object with specified caracteristics for the main and * the incident pipes (radius, width, half-length). A chamfer is created * on the junction of the pipes. * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. - * * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe * \param theL1 Half-length of main pipe @@ -3206,20 +3202,18 @@ module GEOM * \param theL2 Half-length of incident pipe * \param theH Height of the chamfer. * \param theW Width of the chamfer. - * \param theHexMesh false = no partition, true = with partition + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) * \return List of GEOM_Objects, containing the created shape and propagation groups. */ ListOfGO MakePipeTShapeChamfer (in double theR1, in double theW1, in double theL1, in double theR2, in double theW2, in double theL2, in double theH, in double theW, in boolean theHexMesh); - /*! * Create a T-shape object with specified caracteristics for the main and * the incident pipes (radius, width, half-length). A chamfer is created * on the junction of the pipes. * The extremities of the main pipe are located on junctions points P1 and P2. * The extremity of the incident pipe is located on junction point P3. - * * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe * \param theL1 Half-length of main pipe @@ -3228,7 +3222,7 @@ module GEOM * \param theL2 Half-length of incident pipe * \param theH Height of the chamfer. * \param theW Width of the chamfer. - * \param theHexMesh false = no partition, true = with partition + * \param 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 @@ -3238,13 +3232,11 @@ module GEOM in double theR2, in double theW2, in double theL2, in double theH, in double theW, in boolean theHexMesh, in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3); - /*! * Create a T-shape object with specified caracteristics for the main and * the incident pipes (radius, width, half-length). A fillet is created * on the junction of the pipes. * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. - * * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe * \param theL1 Half-length of main pipe @@ -3252,20 +3244,18 @@ module GEOM * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe * \param theRF Radius of curvature of fillet. - * \param theHexMesh false = no partition, true = with partition + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh (default=true) * \return List of GEOM_Objects, containing the created shape and propagation groups. */ ListOfGO MakePipeTShapeFillet (in double theR1, in double theW1, in double theL1, in double theR2, in double theW2, in double theL2, in double theRF, in boolean theHexMesh); - /*! * Create a T-shape object with specified caracteristics for the main and * the incident pipes (radius, width, half-length). A fillet is created * on the junction of the pipes. * The extremities of the main pipe are located on junctions points P1 and P2. * The extremity of the incident pipe is located on junction point P3. - * * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe * \param theL1 Half-length of main pipe @@ -3273,7 +3263,7 @@ module GEOM * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe * \param theRF Radius of curvature of fillet. - * \param theHexMesh false = no partition, true = with partition + * \param 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 @@ -3283,7 +3273,6 @@ 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); - /*@@ insert new functions before this line @@*/ }; diff --git a/resources/tree_pipetshape.png b/resources/tree_pipetshape.png index 4ce53a791..96631a150 100644 Binary files a/resources/tree_pipetshape.png and b/resources/tree_pipetshape.png differ diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx index 0e5e6ae4a..f7a53d238 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -50,7 +50,7 @@ AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI GEOMBase_Skeleton(theGeometryGUI, parent, false) { QPixmap imageOp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE"))); QPixmap imageSel(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); - QPixmap imageImp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT"))); + 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")); @@ -137,30 +137,6 @@ AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose); JunctionPointsSel->TextLabel6->close(); -// QGridLayout* junctionLayout = (QGridLayout*)JunctionPointsSel->GroupBox1->layout(); - -// junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"), JunctionPointsSel->GroupBox1), 3, 0, 1, 1); -// -// QPushButton* ApplyNewL1 = new QPushButton(centralWidget()); -// // ApplyNewL1->setText("Apply new L1"); -// ApplyNewL1->setIcon(imageImp); -// junctionLayout->addWidget(ApplyNewL1, 3, 1, 1, 1); -// -// NewPosValL1 = new QLineEdit(JunctionPointsSel->GroupBox1); -// NewPosValL1->setReadOnly(true); -// junctionLayout->addWidget(NewPosValL1, 3, 2, 1, 1); -// -// junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"), JunctionPointsSel->GroupBox1), 4, 0, 1, 1); -// -// QPushButton* ApplyNewL2 = new QPushButton(centralWidget()); -// // ApplyNewL2->setText("Apply new L2"); -// ApplyNewL2->setIcon(imageImp); -// junctionLayout->addWidget(ApplyNewL2, 4, 1, 1, 1); -// -// NewPosValL2 = new QLineEdit(JunctionPointsSel->GroupBox1); -// NewPosValL2->setReadOnly(true); -// junctionLayout->addWidget(NewPosValL2, 4, 2, 1, 1); - // 1st row, height = 1, colspan = 3 int rowPict = 0, colPict = 0, rowspanPict = 1, colspanPict = 3; // 2nd row, height = 4, col 1 @@ -185,7 +161,7 @@ AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI myMainLayout->addWidget(JunctionPointsSel, rowNewPosVal, colNewPosVal, rowspanNewPosVal, colspanNewPosVal); /***************************************************************/ - setHelpFileName("create_pipe_tshape_page.html"); + setHelpFileName("create__pipetshape__page.html"); Init(); } @@ -235,7 +211,16 @@ void AdvancedGUI_PipeTShapeDlg::Init() { 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)}"; + // Signal/slot connections connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); @@ -754,8 +739,10 @@ bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) { bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1, GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) { - MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);"); - IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);"); + 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(); @@ -821,15 +808,19 @@ bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var th MainTubeGroupParams->SpinBox_DZ->setValue(newL1); connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position"); - MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);"); + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable); + JunctionPointsSel->PushButton4->setStyleSheet(CssAcceptable); } else { MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); - MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);"); + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); + JunctionPointsSel->PushButton4->setStyleSheet(CssRefused); } } - else - MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);"); + else { + MainTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton4->setStyleSheet(CssNormal); + } // std::cerr << "fabs(newL2 - theL2) = " << fabs(newL2 - theL2) << std::endl; if (fabs(newL2 - theL2) > Precision::Approximation()) { @@ -840,15 +831,19 @@ bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var th IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2); connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double))); IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position"); - IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);"); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssAcceptable); + JunctionPointsSel->PushButton5->setStyleSheet(CssAcceptable); } else { IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position"); - IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);"); + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssRefused); + JunctionPointsSel->PushButton5->setStyleSheet(CssRefused); } } - else - IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);"); + else { + IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet(CssNormal); + JunctionPointsSel->PushButton5->setStyleSheet(CssNormal); + } return true; } diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h index a0ba4ebc5..9235d359c 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h @@ -66,6 +66,8 @@ private: DlgRef_2Spin* ChamferGroupParams; DlgRef_1Spin* FilletGroupParams; DlgRef_6Sel* JunctionPointsSel; + QPixmap imageImp; + QString CssNormal, CssAcceptable, CssRefused; // QLineEdit* NewPosValL1; // QLineEdit* NewPosValL2; // QPushButton* ApplyNewL1; diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 96f81eaf4..46cb32ad0 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -227,6 +227,8 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t return false; } + gp_Trsf aTrsfInv = aTrsf.Inverted(); + int expectedGroups = 0; if (shapeType == TSHAPE_BASIC) if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation()) @@ -256,7 +258,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t GEOMImpl_I3DPrimOperations* a3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID()); // - // Uncomment the following lines when GetInPlace bug is solved + // Comment the following lines when GetInPlace bug is solved // == BEGIN // Workaround of GetInPlace bug // Create a bounding box that fits the shape @@ -264,6 +266,11 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t aBox->GetLastFunction()->SetDescription(""); aTransformOperations->TranslateDXDYDZ(aBox, -theL1, -aR1Ext, -aR1Ext); aBox->GetLastFunction()->SetDescription(""); + // Apply transformation to box + BRepBuilderAPI_Transform aTransformationBox(aBox->GetValue(), aTrsf, Standard_False); + TopoDS_Shape aBoxShapeTrsf = aTransformationBox.Shape(); + aBox->GetLastFunction()->SetValue(aBoxShapeTrsf); + // Get the shell of the box Handle(GEOM_Object) aShell = Handle(GEOM_Object)::DownCast(aShapesOperations->MakeExplode(aBox, TopAbs_SHELL, true)->Value(1)); aBox->GetLastFunction()->SetDescription(""); @@ -291,9 +298,9 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t if (!aCompoundOfFaces.IsNull()) { aCompoundOfFaces->GetLastFunction()->SetDescription(""); // Apply transformation to compound of faces - BRepBuilderAPI_Transform aTransformationCompoundOfFaces(aCompoundOfFaces->GetValue(), aTrsf, Standard_False); - TopoDS_Shape aTrsf_CompoundOfFacesShape = aTransformationCompoundOfFaces.Shape(); - aCompoundOfFaces->GetLastFunction()->SetValue(aTrsf_CompoundOfFacesShape); +// BRepBuilderAPI_Transform aTransformationCompoundOfFaces(aCompoundOfFaces->GetValue(), aTrsf, Standard_False); +// TopoDS_Shape aTrsf_CompoundOfFacesShape = aTransformationCompoundOfFaces.Shape(); +// aCompoundOfFaces->GetLastFunction()->SetValue(aTrsf_CompoundOfFacesShape); aCompoundOfFacesList.push_back(aCompoundOfFaces); } } @@ -387,7 +394,15 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t //// Groups of Edges //// ///////////////////////// // Result of propagate + Handle(GEOM_Function) aFunction = theShape->GetLastFunction(); + + + // Apply inverted transformation to shape +// BRepBuilderAPI_Transform aTransformationShapeInv(aShape, aTrsfInv, Standard_False); +// TopoDS_Shape aShapeTrsfInv = aTransformationShapeInv.Shape(); +// aFunction->SetValue(aShapeTrsfInv); + TCollection_AsciiString theDesc = aFunction->GetDescription(); Handle(TColStd_HSequenceOfTransient) aSeqPropagate = aBlocksOperations->Propagate(theShape); if (aSeqPropagate.IsNull() || aSeqPropagate->Length() == 0) { @@ -398,6 +413,12 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t // Recover previous description to get rid of Propagate dump aFunction->SetDescription(theDesc); + + // Apply transformation to shape +// BRepBuilderAPI_Transform aTransformationShape(theShape->GetValue(), aTrsf, Standard_False); +// TopoDS_Shape aShapeTrsf = aTransformationShape.Shape(); +// aFunction->SetValue(aShapeTrsf); + bool addGroup; bool circularFoundAndAdded = false; bool incidentPipeFound = false; @@ -416,9 +437,11 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t continue; TopoDS_Shape aGroupShape = aGroup->GetValue(); + BRepBuilderAPI_Transform aTransformationShapeInv(aGroupShape, aTrsfInv, Standard_False); + TopoDS_Shape aGroupShapeTrsfInv = aTransformationShapeInv.Shape(); TopTools_IndexedMapOfShape anEdgesMap; - TopExp::MapShapes(aGroupShape,TopAbs_EDGE, anEdgesMap); + TopExp::MapShapes(aGroupShapeTrsfInv,TopAbs_EDGE, anEdgesMap); nbEdges = anEdgesMap.Extent(); if (shapeType == TSHAPE_BASIC) { @@ -439,7 +462,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t radialFound =false; flangeFound = false; - TopExp_Explorer Ex(aGroupShape,TopAbs_VERTEX); + TopExp_Explorer Ex(aGroupShapeTrsfInv,TopAbs_VERTEX); while (Ex.More()) { gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); double x=aP.X(), y=aP.Y(), z=aP.Z(); @@ -505,7 +528,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t mainPipeFound = false; flangeFound = false; - TopExp_Explorer Ex(aGroupShape,TopAbs_VERTEX); + TopExp_Explorer Ex(aGroupShapeTrsfInv,TopAbs_VERTEX); while (Ex.More()) { gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current())); double x=aP.X(), y=aP.Y(), z=aP.Z(); @@ -567,55 +590,6 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(/*std::vector t theSeq->Append(aGroup); } -// Handle(GEOM_Object) aGroup; -// if (shapeType == TSHAPE_BASIC) { -// // if (aNbGroups != 11) { -// // SetErrorCode("Bad number of propagation groups"); -// // return false; -// // } -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(1)); -// aGroup->SetName("THICKNESS"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(2)); -// aGroup->SetName("CIRCULAR_QUARTER_PIPE"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(3)); -// aGroup->SetName("HALF_LENGTH_MAIN_PIPE"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(6)); -// aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(5)); -// aGroup->SetName("FLANGE"); -// theSeq->Append(aGroup); -// } else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) { -// if (aNbGroups != 12) { -// SetErrorCode("Bad number of propagation groups"); -// return false; -// } -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(3)); -// aGroup->SetName("THICKNESS"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(1)); -// aGroup->SetName("CIRCULAR_QUARTER_PIPE"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(4)); -// aGroup->SetName("HALF_LENGTH_MAIN_PIPE"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(6)); -// aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(2)); -// aGroup->SetName("FLANGE"); -// theSeq->Append(aGroup); -// aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(7)); -// if (shapeType == TSHAPE_CHAMFER) -// aGroup->SetName("CHAMFER"); -// else -// aGroup->SetName("FILLET"); -// theSeq->Append(aGroup); -// } - SetErrorCode(OK); return true; } @@ -1071,89 +1045,89 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(/*std::vectorMakeHalfPartition(theShape, face_t); - if (Part0.IsNull()) { - std::cerr << "Impossible to build partition between TShape and 1st face" << std::endl; - SetErrorCode("Impossible to build partition between TShape and 1st face"); - return false; - } - Part0->GetLastFunction()->SetDescription(""); - - Handle(GEOM_Object) Te3 ; - if (isNormal) { - if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()) { - std::cerr << "External radius are identical: we do not make partition with plane OXZ" << std::endl; - Te3 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOZ); - } - else { - Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ); - if (Part1.IsNull()) { - std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl; - SetErrorCode("Impossible to build partition between TShape and plane OXZ"); - return false; - } - Part1->GetLastFunction()->SetDescription(""); - Te3 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ); - } - if (Te3.IsNull()) { - std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl; - SetErrorCode("Impossible to build partition between TShape and plane OZ"); - return false; - } - Te3->GetLastFunction()->SetDescription(""); - } - else { - if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()){ // We should never go here - SetErrorCode("Impossible to build TShape"); - return false; - } - else { - Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ); - if (Part1.IsNull()) { - std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl; - SetErrorCode("Impossible to build partition between TShape and plane OXZ"); - return false; - } - Part1->GetLastFunction()->SetDescription(""); - Handle(GEOM_Object) Part2 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ); - if (Part2.IsNull()) { - std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl; - SetErrorCode("Impossible to build partition between TShape and plane OZ"); - return false; - } - Part2->GetLastFunction()->SetDescription(""); - Te3 = aBooleanOperations->MakeHalfPartition(Part2, face_t2); - if (Te3.IsNull()) { - std::cerr << "Impossible to build partition between TShape and 2nd face" << std::endl; - SetErrorCode("Impossible to build partition between TShape and 2nd face"); - return false; - } - Te3->GetLastFunction()->SetDescription(""); - } - } +// Handle(GEOM_Object) Part0 = aBooleanOperations->MakeHalfPartition(theShape, face_t); +// if (Part0.IsNull()) { +// std::cerr << "Impossible to build partition between TShape and 1st face" << std::endl; +// SetErrorCode("Impossible to build partition between TShape and 1st face"); +// return false; +// } +// Part0->GetLastFunction()->SetDescription(""); +// +// Handle(GEOM_Object) Te3 ; +// if (isNormal) { +// if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()) { +// std::cerr << "External radius are identical: we do not make partition with plane OXZ" << std::endl; +// Te3 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOZ); +// } +// else { +// Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ); +// if (Part1.IsNull()) { +// std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl; +// SetErrorCode("Impossible to build partition between TShape and plane OXZ"); +// return false; +// } +// Part1->GetLastFunction()->SetDescription(""); +// Te3 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ); +// } +// if (Te3.IsNull()) { +// std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl; +// SetErrorCode("Impossible to build partition between TShape and plane OZ"); +// return false; +// } +// Te3->GetLastFunction()->SetDescription(""); +// } +// else { +// if (Abs(aR1Ext - aR2Ext) <= Precision::Approximation()){ // We should never go here +// SetErrorCode("Impossible to build TShape"); +// return false; +// } +// else { +// Handle(GEOM_Object) Part1 = aBooleanOperations->MakeHalfPartition(Part0, aPlnOXZ); +// if (Part1.IsNull()) { +// std::cerr << "Impossible to build partition between TShape and plane OXZ" << std::endl; +// SetErrorCode("Impossible to build partition between TShape and plane OXZ"); +// return false; +// } +// Part1->GetLastFunction()->SetDescription(""); +// Handle(GEOM_Object) Part2 = aBooleanOperations->MakeHalfPartition(Part1, aPlnOZ); +// if (Part2.IsNull()) { +// std::cerr << "Impossible to build partition between TShape and plane OZ" << std::endl; +// SetErrorCode("Impossible to build partition between TShape and plane OZ"); +// return false; +// } +// Part2->GetLastFunction()->SetDescription(""); +// Te3 = aBooleanOperations->MakeHalfPartition(Part2, face_t2); +// if (Te3.IsNull()) { +// std::cerr << "Impossible to build partition between TShape and 2nd face" << std::endl; +// SetErrorCode("Impossible to build partition between TShape and 2nd face"); +// return false; +// } +// Te3->GetLastFunction()->SetDescription(""); +// } +// } -// Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient; -// Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient; -// Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient; -// Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient; -// Handle(TColStd_HArray1OfInteger) theMaterials; -// partitionShapes->Append(theShape); -// theTools->Append(aPlnOZ); -// theTools->Append(aPlnOXZ); -// theTools->Append(face_t); -// if (!isNormal) -// theTools->Append(face_t2); -// -// Handle(GEOM_Object) Te3 = aBooleanOperations->MakePartition(partitionShapes, theTools, theKeepInside, theRemoveInside, TopAbs_SOLID, false, theMaterials, 0, false); -// if (Te3.IsNull()) { -// SetErrorCode("Impossible to build partition of TShape"); + Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient; + Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient; + Handle(TColStd_HArray1OfInteger) theMaterials; + partitionShapes->Append(theShape); + theTools->Append(aPlnOZ); + theTools->Append(aPlnOXZ); + theTools->Append(face_t); + if (!isNormal) + theTools->Append(face_t2); + + Handle(GEOM_Object) Te3 = aBooleanOperations->MakePartition(partitionShapes, theTools, theKeepInside, theRemoveInside, TopAbs_SOLID, false, theMaterials, 0, false); + if (Te3.IsNull()) { + SetErrorCode("Impossible to build partition of TShape"); // Handle(GEOM_Object) aCompound = aShapesOperations->MakeCompound(theShapes); // TopoDS_Shape aCompoundShape = aCompound->GetValue(); // theShape->GetLastFunction()->SetValue(aCompoundShape); -// return false; -// } -// Te3->GetLastFunction()->SetDescription(""); -// + return false; + } + Te3->GetLastFunction()->SetDescription(""); + TopoDS_Shape aShape = Te3->GetValue(); theShape->GetLastFunction()->SetValue(aShape); @@ -1262,8 +1236,8 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(/*std::vectorMakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); } + box_e->GetLastFunction()->SetDescription(""); box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); box_e->GetLastFunction()->SetDescription(""); - TCollection_AsciiString theDesc = aFunction->GetDescription(); Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); - aFunction->SetDescription(theDesc); + box_e->GetLastFunction()->SetDescription(""); if (edges_e.IsNull() || edges_e->Length() == 0) { // std::cerr << "Internal edges not found" << std::endl; @@ -1665,14 +1643,11 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap catch (Standard_Failure) { Handle(Standard_Failure) aFail = Standard_Failure::Caught(); SetErrorCode(aFail->GetMessageString()); - try { - aChamfer = aLocalOperations->MakeChamferEdges(aShape, theH, theW, theEdges); - } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); - return NULL; - } + return NULL; + } + if (aChamfer.IsNull()) { + SetErrorCode("Chamfer can not be computed on the given shape with the given parameters"); + return NULL; } aChamfer->GetLastFunction()->SetDescription(""); @@ -1753,9 +1728,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap //============================================================================= /*! - * Create a T-shape object with specified caracteristics for the main and the - * incident pipes (radius, width, half-length). - * The T-shape is placed at junction points P1, P2 and P3. + * MakePipeTShapeChamferWithPosition + * 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 @@ -1843,12 +1821,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap else { box_e = a3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); } + box_e->GetLastFunction()->SetDescription(""); box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); box_e->GetLastFunction()->SetDescription(""); - TCollection_AsciiString theDesc = aFunction->GetDescription(); Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); - aFunction->SetDescription(theDesc); + box_e->GetLastFunction()->SetDescription(""); if (edges_e.IsNull() || edges_e->Length() == 0) { // std::cerr << "Internal edges not found" << std::endl; @@ -1879,8 +1857,14 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap try { aChamfer = aLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges); } - catch (...) { - aChamfer = aLocalOperations->MakeChamferEdges(aShape, theH, theW, theEdges); + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + if (aChamfer.IsNull()) { + SetErrorCode("Chamfer can not be computed on the given shape with the given parameters"); + return NULL; } aChamfer->GetLastFunction()->SetDescription(""); @@ -1954,9 +1938,10 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap //============================================================================= /*! - * 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. + * MakePipeTShapeFillet + * 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 @@ -2034,12 +2019,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap else { box_e = a3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); } + box_e->GetLastFunction()->SetDescription(""); box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); box_e->GetLastFunction()->SetDescription(""); - TCollection_AsciiString theDesc = aFunction->GetDescription(); Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); - aFunction->SetDescription(theDesc); + box_e->GetLastFunction()->SetDescription(""); if (edges_e.IsNull() || edges_e->Length() == 0) { // std::cerr << "Internal edges not found" << std::endl; @@ -2066,8 +2051,20 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap if (theHexMesh && nbEdgesInFillet == 1) break; } - - Handle(GEOM_Object) aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges); + + Handle(GEOM_Object) aFillet; + try { + aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + if (aFillet.IsNull()) { + SetErrorCode("Fillet can not be computed on the given shape with the given parameters"); + return NULL; + } aFillet->GetLastFunction()->SetDescription(""); TopoDS_Shape aFilletShape = aFillet->GetValue(); @@ -2134,10 +2131,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap //============================================================================= /*! - * Create a T-shape object with specified caracteristics for the main and the - * incident pipes (radius, width, half-length). A fillet is created on - * the junction of the pipes. - * The T-shape is placed at junction points P1, P2 and P3. + * MakePipeTShapeFilletWithPosition + * 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 @@ -2223,12 +2222,12 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap else { box_e = a3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1); } + box_e->GetLastFunction()->SetDescription(""); box_e = aTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0); box_e->GetLastFunction()->SetDescription(""); - TCollection_AsciiString theDesc = aFunction->GetDescription(); Handle(TColStd_HSequenceOfInteger) edges_e = aShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN); - aFunction->SetDescription(theDesc); + box_e->GetLastFunction()->SetDescription(""); if (edges_e.IsNull() || edges_e->Length() == 0) { // std::cerr << "Internal edges not found" << std::endl; @@ -2255,8 +2254,20 @@ Handle(TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations::MakePipeTShap if (theHexMesh && nbEdgesInFillet == 1) break; } - - Handle(GEOM_Object) aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges); + + Handle(GEOM_Object) aFillet; + try { + aFillet = aLocalOperations->MakeFilletEdges(aShape, theRF, theEdges); + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + if (aFillet.IsNull()) { + SetErrorCode("Fillet can not be computed on the given shape with the given parameters"); + return NULL; + } aFillet->GetLastFunction()->SetDescription(""); TopoDS_Shape aFilletShape = aFillet->GetValue(); diff --git a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc index cf52cfa0b..1e763fe28 100644 --- a/src/GEOM_I/GEOM_IAdvancedOperations_i.cc +++ b/src/GEOM_I/GEOM_IAdvancedOperations_i.cc @@ -57,8 +57,9 @@ GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i() //============================================================================= /*! - * Create a T-shape object with specified caracteristics for the main and the - * incident pipes (radius, width, half-length). + * MakePipeTShape + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). * Center of the shape is (0,0,0). The main plane of the T-shape is XOY. * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe @@ -66,7 +67,7 @@ GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i() * \param theR2 Internal radius of incident pipe (R2 < R1) * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe - * \param theHexMesh false = no partition, true = with partition + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh * \return List of GEOM_Objects, containing the created shape and propagation groups. */ //============================================================================= @@ -93,16 +94,21 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, //============================================================================= /*! - * Create a T-shape object with specified caracteristics for the main and the - * incident pipes (radius, width, half-length). - * The T-shape is placed at junction points P1, P2 and P3. + * MakePipeTShapeWithPosition + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe * \param theL1 Half-length of main pipe * \param theR2 Internal radius of incident pipe (R2 < R1) * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe - * \param theHexMesh false = no partition, true = with partition + * \param 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. */ //============================================================================= @@ -136,9 +142,10 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::D //============================================================================= /*! - * 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. + * MakePipeTShapeChamfer + * 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 @@ -146,9 +153,9 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::D * \param theR2 Internal radius of incident pipe (R2 < R1) * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe - * \param theH Height of the chamfer. - * \param theW Width of the chamfer. - * \param theHexMesh false = no partition, true = with partition + * \param 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. */ //============================================================================= @@ -176,10 +183,12 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double //============================================================================= /*! - * Create a T-shape object with specified caracteristics for the main and the - * incident pipes (radius, width, half-length). A chamfer is created on - * the junction of the pipes. - * The T-shape is placed at junction points P1, P2 and P3. + * MakePipeTShapeChamferWithPosition + * 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 @@ -188,7 +197,10 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double * \param theL2 Half-length of incident pipe * \param theH Height of the chamfer. * \param theW Width of the chamfer. - * \param theHexMesh false = no partition, true = with partition + * \param 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. */ //============================================================================= @@ -223,9 +235,10 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (C //============================================================================= /*! - * 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. + * MakePipeTShapeFillet + * 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 @@ -234,7 +247,7 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (C * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe * \param theRF Radius of curvature of fillet. - * \param theHexMesh false = no partition, true = with partition + * \param theHexMesh Boolean indicating if shape is prepared for hex mesh * \return List of GEOM_Objects, containing the created shape and propagation groups. */ //============================================================================= @@ -262,18 +275,23 @@ GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double //============================================================================= /*! - * Create a T-shape object with specified caracteristics for the main and the - * incident pipes (radius, width, half-length). A fillet is created on - * the junction of the pipes. - * The T-shape is placed at junction points P1, P2 and P3. + * MakePipeTShapeFilletWithPosition + * Create a T-shape object with specified caracteristics for the main and + * the incident pipes (radius, width, half-length). A fillet is created + * on the junction of the pipes. + * The extremities of the main pipe are located on junctions points P1 and P2. + * The extremity of the incident pipe is located on junction point P3. * \param theR1 Internal radius of main pipe * \param theW1 Width of main pipe * \param theL1 Half-length of main pipe * \param theR2 Internal radius of incident pipe (R2 < R1) * \param theW2 Width of incident pipe (R2+W2 < R1+W1) * \param theL2 Half-length of incident pipe - * \param theRF Radius of curvature of fillet. - * \param theHexMesh false = no partition, true = with partition + * \param 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. */ //============================================================================= diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index cda11a10f..b51040929 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -4136,21 +4136,23 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## 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. + # 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. + # 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 false = no partition, true = with partition (default=true) + # @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_Objects, containing the created shape and propagation groups. # - # @ref tui_creation_tshape "Example" + # @ref tui_creation_pipetshape "Example" def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None): theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2) if (theP1 and theP2 and theP3): @@ -4164,8 +4166,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## 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. + # 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. + # 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 @@ -4174,13 +4178,13 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theL2 Half-length of incident pipe # @param theH Height of the chamfer. # @param theW Width of the chamfer. - # @param theHexMesh false = no partition, true = with partition (default=true) + # @param 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_Objects, containing the created shape and propagation groups. # - # @ref tui_creation_tshape "Example" + # @ref tui_creation_pipetshape "Example" def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None): theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW) if (theP1 and theP2 and theP3): @@ -4194,8 +4198,10 @@ class geompyDC(GEOM._objref_GEOM_Gen): ## 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. + # 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. + # 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 @@ -4203,13 +4209,13 @@ class geompyDC(GEOM._objref_GEOM_Gen): # @param theW2 Width of incident pipe (R2+W2 < R1+W1) # @param theL2 Half-length of incident pipe # @param theRF Radius of curvature of fillet. - # @param theHexMesh false = no partition, true = with partition (default=true) + # @param 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_Objects, containing the created shape and propagation groups. # - # @ref tui_creation_tshape "Example" + # @ref tui_creation_pipetshape "Example" def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None): theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF) if (theP1 and theP2 and theP3):