0020695: EDF 1076 GEOM: Add a new shape in GEOM: T-shape

This commit is contained in:
nge 2010-04-15 17:41:44 +00:00
parent fc426d91b1
commit eea6c0633d
54 changed files with 5250 additions and 28 deletions

View File

@ -264,4 +264,4 @@ DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
SEARCHENGINE = YES

View File

@ -3152,6 +3152,138 @@ module GEOM
*/
interface GEOM_IAdvancedOperations : GEOM_IOperations
{
/*!
* Create a T-shape object with specified caracteristics for the main and
* the incident pipes (radius, width, half-length).
* Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
ListOfGO MakePipeTShape (in double theR1, in double theW1, in double theL1,
in double theR2, in double theW2, in double theL2,
in boolean theHexMesh);
/*!
* Create a T-shape object with specified caracteristics for the main and
* the incident pipes (radius, width, half-length).
* The extremities of the main pipe are located on junctions points P1 and P2.
* The extremity of the incident pipe is located on junction point P3.
*
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theHexMesh false = no partition, true = with partition
* \param theP1 1st junction point of main pipe
* \param theP2 2nd junction point of main pipe
* \param theP3 Junction point of incident pipe
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
ListOfGO MakePipeTShapeWithPosition (in double theR1, in double theW1, in double theL1,
in double theR2, in double theW2, in double theL2,
in boolean theHexMesh,
in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
/*!
* Create a T-shape object with specified caracteristics for the main and
* the incident pipes (radius, width, half-length). A chamfer is created
* on the junction of the pipes.
* Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
*
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theH Height of the chamfer.
* \param theW Width of the chamfer.
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
ListOfGO MakePipeTShapeChamfer (in double theR1, in double theW1, in double theL1,
in double theR2, in double theW2, in double theL2,
in double theH, in double theW, in boolean theHexMesh);
/*!
* Create a T-shape object with specified caracteristics for the main and
* the incident pipes (radius, width, half-length). A chamfer is created
* on the junction of the pipes.
* The extremities of the main pipe are located on junctions points P1 and P2.
* The extremity of the incident pipe is located on junction point P3.
*
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theH Height of the chamfer.
* \param theW Width of the chamfer.
* \param theHexMesh false = no partition, true = with partition
* \param theP1 1st junction point of main pipe
* \param theP2 2nd junction point of main pipe
* \param theP3 Junction point of incident pipe
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
ListOfGO MakePipeTShapeChamferWithPosition (in double theR1, in double theW1, in double theL1,
in double theR2, in double theW2, in double theL2,
in double theH, in double theW, in boolean theHexMesh,
in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
/*!
* Create a T-shape object with specified caracteristics for the main and
* the incident pipes (radius, width, half-length). A fillet is created
* on the junction of the pipes.
* Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
*
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theRF Radius of curvature of fillet.
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
ListOfGO MakePipeTShapeFillet (in double theR1, in double theW1, in double theL1,
in double theR2, in double theW2, in double theL2,
in double theRF, in boolean theHexMesh);
/*!
* Create a T-shape object with specified caracteristics for the main and
* the incident pipes (radius, width, half-length). A fillet is created
* on the junction of the pipes.
* The extremities of the main pipe are located on junctions points P1 and P2.
* The extremity of the incident pipe is located on junction point P3.
*
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theRF Radius of curvature of fillet.
* \param theHexMesh false = no partition, true = with partition
* \param theP1 1st junction point of main pipe
* \param theP2 2nd junction point of main pipe
* \param theP3 Junction point of incident pipe
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
ListOfGO MakePipeTShapeFilletWithPosition (in double theR1, in double theW1, in double theL1,
in double theR2, in double theW2, in double theL2,
in double theRF, in boolean theHexMesh,
in GEOM_Object theP1, in GEOM_Object theP2, in GEOM_Object theP3);
/*@@ insert new functions before this line @@*/
};

View File

@ -229,6 +229,16 @@ coordsys.png \
translation.png
ADVANCED_RESOURCES =
ADVANCED_RESOURCES += pipetshape.png tree_pipetshape.png pipetshape_import_icon.png
ADVANCED_RESOURCES += dlg_pipetshape.png dlg_pipetshapechamfer.png dlg_pipetshapefillet.png
ADVANCED_RESOURCES += dlg_pipetshapel1.png dlg_pipetshaper1.png dlg_pipetshapew1.png
ADVANCED_RESOURCES += dlg_pipetshapel2.png dlg_pipetshaper2.png dlg_pipetshapew2.png
ADVANCED_RESOURCES += dlg_pipetshapechamferl1.png dlg_pipetshapechamferr1.png dlg_pipetshapechamferw1.png
ADVANCED_RESOURCES += dlg_pipetshapechamferl2.png dlg_pipetshapechamferr2.png dlg_pipetshapechamferw2.png
ADVANCED_RESOURCES += dlg_pipetshapechamferh.png dlg_pipetshapechamferw.png
ADVANCED_RESOURCES += dlg_pipetshapefilletl1.png dlg_pipetshapefilletr1.png dlg_pipetshapefilletw1.png
ADVANCED_RESOURCES += dlg_pipetshapefilletl2.png dlg_pipetshapefilletr2.png dlg_pipetshapefilletw2.png
ADVANCED_RESOURCES += dlg_pipetshapefilletrf.png
##@@ insert new functions before this line @@##
dist_salomeres_DATA += $(ADVANCED_RESOURCES)

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
resources/pipetshape.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 901 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

View File

@ -31,6 +31,7 @@
#include <SUIT_Desktop.h>
#include <SalomeApp_Application.h>
#include "AdvancedGUI_PipeTShapeDlg.h"
//@@ insert new functions before this line @@//
#include <QDialog>
@ -65,6 +66,12 @@ bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
QDialog* aDlg = NULL;
switch ( theCommandID ) {
case GEOMOp::OpPipeTShape:
aDlg = new AdvancedGUI_PipeTShapeDlg( getGeometryGUI(), parent );
break;
// case GEOMOp::OpPipeTShapeGroups:
// aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent );
// break;
//@@ insert new functions before this line @@//
default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );

View File

@ -0,0 +1,975 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include "AdvancedGUI_PipeTShapeDlg.h"
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_OverrideCursor.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_Tools.h>
#include <LightApp_SelectionMgr.h>
// OCCT Includes
#include <TopoDS_Shape.hxx>
#include <TopoDS.hxx>
#include <TopExp.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <gp_Pnt.hxx>
#include <BRep_Tool.hxx>
#include <GEOMImpl_Types.hxx>
//=================================================================================
// Constructor
//=================================================================================
AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI, QWidget* parent) :
GEOMBase_Skeleton(theGeometryGUI, parent, false) {
QPixmap imageOp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPETSHAPE")));
QPixmap imageSel(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
QPixmap imageImp(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICO_PIPETSHAPE_IMPORT")));
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
setWindowTitle(tr("GEOM_PIPE_TSHAPE_TITLE"));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE_TSHAPE"));
mainFrame()->RadioButton1->setIcon(imageOp);
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
QGridLayout* myMainLayout = new QGridLayout(centralWidget());
myMainLayout->setMargin(0);
myMainLayout->setSpacing(6);
PictureView = new DlgRef_PipeTShape_ScrollArea();
PictureView->PipeTShape->setBackgroundRole(QPalette::Base);
PictureView->PipeTShape->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
PictureView->PipeTShape->setScaledContents(true);
MainTubeGroupParams = new DlgRef_3Spin();
MainTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_MPIPE"));
MainTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
MainTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
MainTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
IncidentTubeGroupParams = new DlgRef_3Spin();
IncidentTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_IPIPE"));
IncidentTubeGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
IncidentTubeGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_W"));
IncidentTubeGroupParams->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_L"));
ChamferGroupParams = new DlgRef_2Spin();
ChamferGroupParams->GroupBox1->setCheckable(true);
ChamferGroupParams->GroupBox1->setChecked(false);
ChamferGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_CHAMFER"));
ChamferGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_H"));
ChamferGroupParams->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_CHAMFER_W"));
FilletGroupParams = new DlgRef_1Spin();
FilletGroupParams->GroupBox1->setCheckable(true);
FilletGroupParams->GroupBox1->setChecked(false);
FilletGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_FILLET"));
FilletGroupParams->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_R"));
HexMeshCheckBox = new QCheckBox();
HexMeshCheckBox->setText(tr("GEOM_PIPE_TSHAPE_HEX"));
HexMeshCheckBox->setChecked(true);
JunctionPointsSel = new DlgRef_6Sel();
JunctionPointsSel->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_POSITION"));
JunctionPointsSel->GroupBox1->setCheckable(true);
JunctionPointsSel->GroupBox1->setChecked(false);
JunctionPointsSel->PushButton1->setIcon(imageSel);
JunctionPointsSel->LineEdit1->setReadOnly(true);
JunctionPointsSel->LineEdit1->setText("");
JunctionPointsSel->TextLabel1->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P1"));
JunctionPointsSel->PushButton2->setIcon(imageSel);
JunctionPointsSel->LineEdit2->setReadOnly(true);
JunctionPointsSel->LineEdit2->setText("");
JunctionPointsSel->TextLabel2->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P2"));
JunctionPointsSel->PushButton3->setIcon(imageSel);
JunctionPointsSel->LineEdit3->setReadOnly(true);
JunctionPointsSel->LineEdit3->setText("");
JunctionPointsSel->TextLabel3->setText(tr("GEOM_PIPE_TSHAPE_POSITION_P3"));
JunctionPointsSel->PushButton4->setIcon(imageImp);
JunctionPointsSel->LineEdit4->setReadOnly(true);
JunctionPointsSel->LineEdit4->setText("");
JunctionPointsSel->TextLabel4->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"));
JunctionPointsSel->PushButton5->setIcon(imageImp);
JunctionPointsSel->LineEdit5->setReadOnly(true);
JunctionPointsSel->LineEdit5->setText("");
JunctionPointsSel->TextLabel5->setText(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"));
JunctionPointsSel->PushButton6->setAttribute(Qt::WA_DeleteOnClose);
JunctionPointsSel->PushButton6->close();
JunctionPointsSel->LineEdit6->setAttribute(Qt::WA_DeleteOnClose);
JunctionPointsSel->LineEdit6->close();
JunctionPointsSel->TextLabel6->setAttribute(Qt::WA_DeleteOnClose);
JunctionPointsSel->TextLabel6->close();
// QGridLayout* junctionLayout = (QGridLayout*)JunctionPointsSel->GroupBox1->layout();
// junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L1"), JunctionPointsSel->GroupBox1), 3, 0, 1, 1);
//
// QPushButton* ApplyNewL1 = new QPushButton(centralWidget());
// // ApplyNewL1->setText("Apply new L1");
// ApplyNewL1->setIcon(imageImp);
// junctionLayout->addWidget(ApplyNewL1, 3, 1, 1, 1);
//
// NewPosValL1 = new QLineEdit(JunctionPointsSel->GroupBox1);
// NewPosValL1->setReadOnly(true);
// junctionLayout->addWidget(NewPosValL1, 3, 2, 1, 1);
//
// junctionLayout->addWidget(new QLabel(tr("GEOM_PIPE_TSHAPE_POSITION_LBL_L2"), JunctionPointsSel->GroupBox1), 4, 0, 1, 1);
//
// QPushButton* ApplyNewL2 = new QPushButton(centralWidget());
// // ApplyNewL2->setText("Apply new L2");
// ApplyNewL2->setIcon(imageImp);
// junctionLayout->addWidget(ApplyNewL2, 4, 1, 1, 1);
//
// NewPosValL2 = new QLineEdit(JunctionPointsSel->GroupBox1);
// NewPosValL2->setReadOnly(true);
// junctionLayout->addWidget(NewPosValL2, 4, 2, 1, 1);
// 1st row, height = 1, colspan = 3
int rowPict = 0, colPict = 0, rowspanPict = 1, colspanPict = 3;
// 2nd row, height = 4, col 1
int rowMain = rowspanPict, colMain = 0, rowspanMain = 2, colspanMain = 1;
int rowCham = rowspanPict + rowspanMain, colCham = 0, rowspanCham = 2, colspanCham = 1;
// 2nd row, height = 4, col 2
int rowInc = rowspanPict, colInc = 1, rowspanInc = 2, colspanInc = 1;
int rowFill = rowspanPict + rowspanInc, colFill = 1, rowspanFill = 1, colspanFill = 1;
int rowHex = rowspanPict + rowspanInc + rowspanFill, colHex = 1, rowspanHex = 1, colspanHex = 1;
// 2nd row, height = 4, col 3
int rowNewPosVal = rowspanPict, colNewPosVal = 2, rowspanNewPosVal = 4, colspanNewPosVal = 1;
myMainLayout->addWidget(PictureView, rowPict, colPict, rowspanPict, colspanPict);
myMainLayout->addWidget(MainTubeGroupParams, rowMain, colMain, rowspanMain, colspanMain);
myMainLayout->addWidget(FilletGroupParams, rowFill, colFill, rowspanFill, colspanFill);
myMainLayout->addWidget(HexMeshCheckBox, rowHex, colHex, rowspanHex, colspanHex);
myMainLayout->addWidget(IncidentTubeGroupParams, rowInc, colInc, rowspanInc, colspanInc);
myMainLayout->addWidget(ChamferGroupParams, rowCham, colCham, rowspanCham, colspanCham);
myMainLayout->addWidget(JunctionPointsSel, rowNewPosVal, colNewPosVal, rowspanNewPosVal, colspanNewPosVal);
/***************************************************************/
setHelpFileName("create_pipe_tshape_page.html");
Init();
}
//=================================================================================
// Destructor
//=================================================================================
AdvancedGUI_PipeTShapeDlg::~AdvancedGUI_PipeTShapeDlg() {
// no need to delete child widgets, Qt does it all for us
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::Init() {
// Get setting of step value from file configuration
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
PictureView->PipeTShape->setPixmap(imagePipeTShape);
PictureView->PipeTShape->adjustSize();
myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
myOkPoint1 = myOkPoint2 = myOkPoint3 = false;
pipeTShapeGroupObjects.clear();
// min, max, step and decimals for spin boxes
initSpinBox(MainTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(MainTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(MainTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(IncidentTubeGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(IncidentTubeGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(IncidentTubeGroupParams->SpinBox_DZ, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(ChamferGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(ChamferGroupParams->SpinBox_DY, Precision::Approximation(), COORD_MAX, step, "length_precision");
initSpinBox(FilletGroupParams->SpinBox_DX, Precision::Approximation(), COORD_MAX, step, "length_precision");
// init variables
MainTubeGroupParams->SpinBox_DX->setValue(80);
MainTubeGroupParams->SpinBox_DY->setValue(20);
MainTubeGroupParams->SpinBox_DZ->setValue(200);
IncidentTubeGroupParams->SpinBox_DX->setValue(50);
IncidentTubeGroupParams->SpinBox_DY->setValue(20);
IncidentTubeGroupParams->SpinBox_DZ->setValue(200);
ChamferGroupParams->SpinBox_DX->setValue(20);
ChamferGroupParams->SpinBox_DY->setValue(10);
FilletGroupParams->SpinBox_DX->setValue(20);
// Signal/slot connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
// ValueChangedInSpinBox
connect(MainTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(MainTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(IncidentTubeGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(IncidentTubeGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(ChamferGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(ChamferGroupParams->SpinBox_DY, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
connect(FilletGroupParams->SpinBox_DX, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
// ChamferOrFillet
connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
// Preview
// connect(PreviewPushButton, SIGNAL(clicked()), this, SLOT(DisplayPreview()));
// Position
connect(JunctionPointsSel->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(SetPosition(bool)));
connect(JunctionPointsSel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(JunctionPointsSel->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(JunctionPointsSel->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
// ApplyNewDimensions
connect(JunctionPointsSel->PushButton4, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
connect(JunctionPointsSel->PushButton5, SIGNAL(clicked()), this, SLOT(ApplyNewDimensions()));
connect(QApplication::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), this, SLOT(UpdatePicture(QWidget*, QWidget*)));
//@@ put additional signal/slot connections here @@//
initName(tr("GEOM_PIPE_TSHAPE"));
DisplayPreview();
}
//=================================================================================
// function : ApplyNewDimensions()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::ApplyNewDimensions() {
QPushButton* send = (QPushButton*) sender();
bool ok = false;
double newVal;
if (send == JunctionPointsSel->PushButton4) {
if (!JunctionPointsSel->LineEdit4->text().isEmpty()) {
newVal = JunctionPointsSel->LineEdit4->text().toDouble(&ok);
if (ok) {
disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
MainTubeGroupParams->SpinBox_DZ->setValue(newVal);
connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
MainTubeGroupParams->SpinBox_DZ->setToolTip("");
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
DisplayPreview();
}
}
}
else if (send == JunctionPointsSel->PushButton5) {
if (!JunctionPointsSel->LineEdit5->text().isEmpty()) {
newVal = JunctionPointsSel->LineEdit5->text().toDouble(&ok);
if (ok) {
disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
IncidentTubeGroupParams->SpinBox_DZ->setValue(newVal);
connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
DisplayPreview();
}
}
}
}
//=================================================================================
// function : UpdatePicture()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::UpdatePicture(QWidget* old, QWidget* now) {
if (ChamferGroupParams->GroupBox1->isChecked())
if (now == MainTubeGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R1"));
else if (now == MainTubeGroupParams->SpinBox_DY)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W1"));
else if (now == MainTubeGroupParams->SpinBox_DZ)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L1"));
else if (now == IncidentTubeGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_R2"));
else if (now == IncidentTubeGroupParams->SpinBox_DY)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W2"));
else if (now == IncidentTubeGroupParams->SpinBox_DZ)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_L2"));
else if (now == ChamferGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_H"));
else if (now == ChamferGroupParams->SpinBox_DY)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER_W"));
else
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
else if (FilletGroupParams->GroupBox1->isChecked())
if (now == MainTubeGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R1"));
else if (now == MainTubeGroupParams->SpinBox_DY)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W1"));
else if (now == MainTubeGroupParams->SpinBox_DZ)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L1"));
else if (now == IncidentTubeGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_R2"));
else if (now == IncidentTubeGroupParams->SpinBox_DY)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_W2"));
else if (now == IncidentTubeGroupParams->SpinBox_DZ)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_L2"));
else if (now == FilletGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET_RF"));
else
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
else
if (now == MainTubeGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R1"));
else if (now == MainTubeGroupParams->SpinBox_DY)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W1"));
else if (now == MainTubeGroupParams->SpinBox_DZ)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L1"));
else if (now == IncidentTubeGroupParams->SpinBox_DX)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_R2"));
else if (now == IncidentTubeGroupParams->SpinBox_DY)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_W2"));
else if (now == IncidentTubeGroupParams->SpinBox_DZ)
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_L2"));
else
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
PictureView->PipeTShape->setPixmap(imagePipeTShape);
PictureView->PipeTShape->adjustSize();
}
//=================================================================================
// function : SetPosition()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::SetPosition(bool isChecked) {
if (isChecked) {
erasePreview();
JunctionPointsSel->LineEdit4->setText("");
JunctionPointsSel->LineEdit5->setText("");
// connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(
// SelectionIntoArgument()));
JunctionPointsSel->PushButton1->click();
SelectionIntoArgument();
} else {
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
JunctionPointsSel->LineEdit4->setText("");
JunctionPointsSel->LineEdit5->setText("");
DisplayPreview();
}
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::ValueChangedInSpinBox(double newValue)
{
if (myOkPoint1 && myOkPoint2 && myOkPoint3)
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
DisplayPreview();
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
erasePreview();
// myEditCurrentArgument->setText("");
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() != 1) {
if (myEditCurrentArgument == JunctionPointsSel->LineEdit1)
myOkPoint1 = false;
else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2)
myOkPoint2 = false;
else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3)
myOkPoint3 = false;
return;
myEditCurrentArgument->setText("");
}
// nbSel == 1
if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
if (!CORBA::is_nil(aSelectedObject) && aRes) {
QString aName = GEOMBase::GetName(aSelectedObject);
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(anIO, aMap);
if (aMap.Extent() == 1) { // Local Selection
int anIndex = aMap(1);
aName += QString(":vertex_%1").arg(anIndex);
//Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations(getStudyId());
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
} else {
aSelectedObject = aFindedObject; // get Object from study
}
GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE);
} else { // Global Selection
if (aShape.ShapeType() != TopAbs_VERTEX) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
if (aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX) {
return;
}
myEditCurrentArgument->setText(aName);
if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
myPoint1 = aSelectedObject;
myOkPoint1 = true;
if (!myOkPoint2)
JunctionPointsSel->PushButton2->click();
} else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
myPoint2 = aSelectedObject;
myOkPoint2 = true;
if (!myOkPoint3)
JunctionPointsSel->PushButton3->click();
} else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
myPoint3 = aSelectedObject;
myOkPoint3 = true;
if (!myOkPoint1)
JunctionPointsSel->PushButton1->click();
}
}
}
if (myOkPoint1 && myOkPoint2 && myOkPoint3) {
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
DisplayPreview();
}
// Standard_Boolean testResult = Standard_False;
// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
// if (!testResult || aSelectedObject->_is_nil())
// return;
//
// myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
//
// // clear selection
// disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
// myGeomGUI->getApp()->selectionMgr()->clearSelected();
// connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
//
// if (myEditCurrentArgument == JunctionPointsSel->LineEdit1) {
// myPoint1 = aSelectedObject;
// myOkPoint1 = true;
// if (!myOkPoint2)
// JunctionPointsSel->PushButton2->click();
// // P2GroupParams->PushButton1->click();
// } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit2) {
// // } else if (myEditCurrentArgument == P2GroupParams->LineEdit1) {
// myPoint2 = aSelectedObject;
// myOkPoint2 = true;
// if (!myOkPoint3)
// JunctionPointsSel->PushButton3->click();
// // P3GroupParams->PushButton1->click();
// } else if (myEditCurrentArgument == JunctionPointsSel->LineEdit3) {
// // } else if (myEditCurrentArgument == P3GroupParams->LineEdit1) {
// myPoint3 = aSelectedObject;
// myOkPoint3 = true;
// if (!myOkPoint1)
// JunctionPointsSel->PushButton1->click();
// }
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument() {
QPushButton* send = (QPushButton*) sender();
if (send == JunctionPointsSel->PushButton1) {
myEditCurrentArgument = JunctionPointsSel->LineEdit1;
JunctionPointsSel->PushButton2->setDown(false);
JunctionPointsSel->LineEdit2->setEnabled(false);
JunctionPointsSel->PushButton3->setDown(false);
JunctionPointsSel->LineEdit3->setEnabled(false);
} else if (send == JunctionPointsSel->PushButton2) {
myEditCurrentArgument = JunctionPointsSel->LineEdit2;
JunctionPointsSel->PushButton1->setDown(false);
JunctionPointsSel->LineEdit1->setEnabled(false);
JunctionPointsSel->PushButton3->setDown(false);
JunctionPointsSel->LineEdit3->setEnabled(false);
} else if (send == JunctionPointsSel->PushButton3) {
myEditCurrentArgument = JunctionPointsSel->LineEdit3;
JunctionPointsSel->PushButton1->setDown(false);
JunctionPointsSel->LineEdit1->setEnabled(false);
JunctionPointsSel->PushButton2->setDown(false);
JunctionPointsSel->LineEdit2->setEnabled(false);
}
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
myEditCurrentArgument->setText("");
// after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
JunctionPointsSel->LineEdit4->setText("");
JunctionPointsSel->LineEdit5->setText("");
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
// globalSelection(GEOM_POINT);
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
}
//=================================================================================
// function : SetDoubleSpinBoxStep()
// purpose : Double spin box management
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::SetDoubleSpinBoxStep(double step) {
MainTubeGroupParams->SpinBox_DX->setSingleStep(step);
MainTubeGroupParams->SpinBox_DY->setSingleStep(step);
MainTubeGroupParams->SpinBox_DZ->setSingleStep(step);
IncidentTubeGroupParams->SpinBox_DX->setSingleStep(step);
IncidentTubeGroupParams->SpinBox_DY->setSingleStep(step);
IncidentTubeGroupParams->SpinBox_DZ->setSingleStep(step);
ChamferGroupParams->SpinBox_DX->setSingleStep(step);
ChamferGroupParams->SpinBox_DY->setSingleStep(step);
FilletGroupParams->SpinBox_DX->setSingleStep(step);
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::ClickOnOk() {
if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool AdvancedGUI_PipeTShapeDlg::ClickOnApply() {
if (!onAccept())
return false;
initName();
return true;
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::ActivateThisDialog() {
GEOMBase_Skeleton::ActivateThisDialog();
// globalSelection( GEOM_POINT);
// connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(
// currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if (myOkPoint1 && myOkPoint2 && myOkPoint3)
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
DisplayPreview();
}
//=================================================================================
// function : enterEvent [REDEFINED]
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) {
if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
//=================================================================================
// function : ChamferOrFillet()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) {
QGroupBox* send = (QGroupBox*) sender();
if (send == ChamferGroupParams->GroupBox1) {
if (send->isChecked()) {
disconnect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
FilletGroupParams->GroupBox1->setChecked(false);
connect(FilletGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_CHAMFER"));
}
else
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
PictureView->PipeTShape->setPixmap(imagePipeTShape);
if (myOkPoint1 && myOkPoint2 && myOkPoint3)
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
DisplayPreview();
} else if (send == FilletGroupParams->GroupBox1) {
if (send->isChecked()) {
disconnect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, 0);
ChamferGroupParams->GroupBox1->setChecked(!send->isChecked());
connect(ChamferGroupParams->GroupBox1, SIGNAL(toggled(bool)), this, SLOT(ChamferOrFillet(bool)));
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE_FILLET"));
}
else
imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE"));
PictureView->PipeTShape->setPixmap(imagePipeTShape);
if (myOkPoint1 && myOkPoint2 && myOkPoint3)
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
DisplayPreview();
}
}
//=================================================================================
// function : DisplayPreview()
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::DisplayPreview(const bool activate, const bool update, const bool toRemoveFromEngine,
const double lineWidth, const int displayMode, const int color) {
isPreview = true;
QString msg;
if (!isValid(msg)) {
erasePreview(update);
isPreview = false;
return;
}
erasePreview(false);
try {
SUIT_OverrideCursor wc;
ObjectList objects;
bool hexMeshState = HexMeshCheckBox->isChecked();
HexMeshCheckBox->setChecked(false);
if (!executeNoCheck(objects) || !getOperation()->IsDone()) {
wc.suspend();
} else {
ObjectList::iterator it = objects.begin();
GEOM::GEOM_Object_var obj = *it;
displayPreview(obj, true, activate, false, lineWidth, displayMode, color);
if (toRemoveFromEngine)
obj->Destroy();
}
HexMeshCheckBox->setChecked(hexMeshState);
} catch (const SALOME::SALOME_Exception& e) {
SalomeApp_Tools::QtCatchCorbaException(e);
}
isPreview = false;
if (update)
updateViewer();
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation() {
return getGeomEngine()->GetIAdvancedOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
bool AdvancedGUI_PipeTShapeDlg::isValid(QString& msg) {
bool ok = true;
ok = MainTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
ok = MainTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
ok = MainTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
ok = IncidentTubeGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
ok = IncidentTubeGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
ok = IncidentTubeGroupParams->SpinBox_DZ->isValid(msg, !IsPreview()) && ok;
ok = ChamferGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
ok = ChamferGroupParams->SpinBox_DY->isValid(msg, !IsPreview()) && ok;
ok = FilletGroupParams->SpinBox_DX->isValid(msg, !IsPreview()) && ok;
ok = fabs(MainTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
ok = fabs(MainTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
ok = fabs(MainTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
ok = fabs(IncidentTubeGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
ok = fabs(IncidentTubeGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
ok = fabs(IncidentTubeGroupParams->SpinBox_DZ->value()) > Precision::Confusion() && ok;
ok = fabs(ChamferGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
ok = fabs(ChamferGroupParams->SpinBox_DY->value()) > Precision::Confusion() && ok;
ok = fabs(FilletGroupParams->SpinBox_DX->value()) > Precision::Confusion() && ok;
if (JunctionPointsSel->GroupBox1->isChecked())
ok = myOkPoint1 && myOkPoint2 && myOkPoint3 && ok;
return ok;
}
//=================================================================================
// function : CheckCompatiblePosition()
// purpose :
//=================================================================================
bool AdvancedGUI_PipeTShapeDlg::CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance) {
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
JunctionPointsSel->LineEdit4->setText("");
JunctionPointsSel->LineEdit5->setText("");
MainTubeGroupParams->SpinBox_DZ->setToolTip("");
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("");
TopoDS_Shape aShape;
gp_Pnt P1, P2, P3;
if ( GEOMBase::GetShape( theP1, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
P1 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
else
return false;
if ( GEOMBase::GetShape( theP2, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
P2 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
else
return false;
if ( GEOMBase::GetShape( theP3, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
P3 = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
else
return false;
double d12 = P1.Distance(P2);
double d13 = P1.Distance(P3);
double d23 = P2.Distance(P3);
if (Abs(d12) <= Precision::Confusion()) {
// SetErrorCode("Junctions points P1 and P2 are identical");
return false;
}
if (Abs(d13) <= Precision::Confusion()) {
// SetErrorCode("Junctions points P1 and P3 are identical");
return false;
}
if (Abs(d23) <= Precision::Confusion()) {
// SetErrorCode("Junctions points P2 and P3 are identical");
return false;
}
// std::cerr << "theL1: " << theL1 << std::endl;
// std::cerr << "theL2: " << theL2 << std::endl;
// std::cerr << "d12: " << d12 << std::endl;
// std::cerr << "d13: " << d13 << std::endl;
// std::cerr << "d23: " << d23 << std::endl;
long double newL1 = 0.5 * d12;
long double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
JunctionPointsSel->LineEdit4->setText(QString::number(newL1,'f',7));
JunctionPointsSel->LineEdit5->setText(QString::number(newL2,'f',7));
// std::cerr << "newL1: " << newL1 << std::endl;
// std::cerr << "newL2: " << newL2 << std::endl;
if (fabs(newL1 - theL1) > Precision::Approximation()) {
if ((newL1 * (1 - theTolerance) - theL1 <= Precision::Approximation()) &&
(newL1 * (1 + theTolerance) - theL1 >= Precision::Approximation())) {
// std::cerr << "theL1 = newL1" << std::endl;
disconnect(MainTubeGroupParams->SpinBox_DZ, 0, this, 0);
MainTubeGroupParams->SpinBox_DZ->setValue(newL1);
connect(MainTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
MainTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);");
}
else {
MainTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);");
}
}
else
MainTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
// std::cerr << "fabs(newL2 - theL2) = " << fabs(newL2 - theL2) << std::endl;
if (fabs(newL2 - theL2) > Precision::Approximation()) {
if ((newL2 * (1 - theTolerance) - theL2 <= Precision::Approximation()) &&
(newL2 * (1 + theTolerance) - theL2 >= Precision::Approximation())) {
// std::cerr << "theL2 = newL2" << std::endl;
disconnect(IncidentTubeGroupParams->SpinBox_DZ, 0, this, 0);
IncidentTubeGroupParams->SpinBox_DZ->setValue(newL2);
connect(IncidentTubeGroupParams->SpinBox_DZ, SIGNAL(valueChanged( double )), this, SLOT(ValueChangedInSpinBox(double)));
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value was recomputed to fit with position");
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(85, 170, 127);");
}
else {
IncidentTubeGroupParams->SpinBox_DZ->setToolTip("Value is incompatible with position");
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 0, 0);");
}
}
else
IncidentTubeGroupParams->SpinBox_DZ->setStyleSheet("background-color: rgb(255, 255, 255);");
return true;
}
bool AdvancedGUI_PipeTShapeDlg::execute(ObjectList& objects) {
if (JunctionPointsSel->GroupBox1->isChecked() && myOkPoint1 && myOkPoint2 && myOkPoint3)
CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01);
return executeNoCheck(objects);
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool AdvancedGUI_PipeTShapeDlg::executeNoCheck(ObjectList& objects) {
bool res = false;
// GEOM::GEOM_Object_var anObj;
GEOM::ListOfGO_var anObj;
GEOM::GEOM_IAdvancedOperations_var anOper = GEOM::GEOM_IAdvancedOperations::_narrow(getOperation());
//@@ retrieve input values from the widgets here @@//
CORBA::Double theR1 = MainTubeGroupParams->SpinBox_DX->value();
CORBA::Double theW1 = MainTubeGroupParams->SpinBox_DY->value();
CORBA::Double theL1 = MainTubeGroupParams->SpinBox_DZ->value();
CORBA::Double theR2 = IncidentTubeGroupParams->SpinBox_DX->value();
CORBA::Double theW2 = IncidentTubeGroupParams->SpinBox_DY->value();
CORBA::Double theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
CORBA::Double theH = ChamferGroupParams->SpinBox_DX->value();
CORBA::Double theW = ChamferGroupParams->SpinBox_DY->value();
CORBA::Double theRF = FilletGroupParams->SpinBox_DX->value();
CORBA::Boolean theHexMesh = HexMeshCheckBox->isChecked();
// if (JunctionPointsSel->GroupBox1->isChecked()) {
// CheckCompatiblePosition(theL1, theL2, myPoint1, myPoint2, myPoint3, 0.01);
// theL1 = MainTubeGroupParams->SpinBox_DZ->value();
// theL2 = IncidentTubeGroupParams->SpinBox_DZ->value();
// }
// call engine function
if (ChamferGroupParams->GroupBox1->isChecked()) {
if (JunctionPointsSel->GroupBox1->isChecked())
anObj = anOper->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
theHexMesh, myPoint1, myPoint2, myPoint3);
else
anObj = anOper->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
}
else if (FilletGroupParams->GroupBox1->isChecked()) {
if (JunctionPointsSel->GroupBox1->isChecked())
anObj = anOper->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF,
theHexMesh, myPoint1, myPoint2, myPoint3);
else
anObj = anOper->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
}
else {
if (JunctionPointsSel->GroupBox1->isChecked())
anObj = anOper->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, myPoint1,
myPoint2, myPoint3);
else
anObj = anOper->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
}
res = anObj->length();
if (!res)
return false;
// res = !anObj->_is_nil();
if (res && !IsPreview()) {
QStringList aParameters;
//@@ put stringified input parameters to the string list here to store in the data model for notebook @@//
aParameters << MainTubeGroupParams->SpinBox_DX->text(); // R1 parameter
aParameters << MainTubeGroupParams->SpinBox_DY->text(); // W1 parameter
aParameters << MainTubeGroupParams->SpinBox_DZ->text(); // L1 parameter
aParameters << IncidentTubeGroupParams->SpinBox_DX->text(); // R2 parameter
aParameters << IncidentTubeGroupParams->SpinBox_DY->text(); // W2 parameter
aParameters << IncidentTubeGroupParams->SpinBox_DZ->text(); // L2 parameter
if (ChamferGroupParams->GroupBox1->isChecked()) {// Chamfer parameter
aParameters << ChamferGroupParams->SpinBox_DX->text(); // H parameter
aParameters << ChamferGroupParams->SpinBox_DY->text(); // W parameter
}
if (FilletGroupParams->GroupBox1->isChecked()) // Fillet parameter
aParameters << FilletGroupParams->SpinBox_DX->text(); // RF parameter
if (aParameters.count() > 0)
anObj[0]->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back(anObj[0]._retn());
pipeTShapeGroupObjects.clear();
for (int i = 1, n = anObj->length(); i < n; i++) {
pipeTShapeGroupObjects.push_back(anObj[i]._retn());
}
return objects.size() > 0;
}
//=================================================================================
// function : restoreSubShapes
// purpose :
//=================================================================================
void AdvancedGUI_PipeTShapeDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject) {
SALOMEDS::GenericAttribute_var anAttr;
if (!theSObject->FindAttribute(anAttr, "AttributeIOR"))
return;
SALOMEDS::AttributeIOR_var anAttrIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var anIORso = anAttrIOR->Value();
// get Object from SObject
GEOM::GEOM_Object_var theFather = GEOM::GEOM_Object::_narrow(myGeomGUI->getApp()->orb()->string_to_object(anIORso));
if (CORBA::is_nil(theFather))
return;
ObjectList::iterator it = pipeTShapeGroupObjects.begin();
for (int i = 0; it != pipeTShapeGroupObjects.end(); it++, i++) {
// std::cerr << "Add group " << (*it)->GetName() << std::endl;
getGeomEngine()->AddInStudy(theStudy, (*it), tr((*it)->GetName()).toStdString().c_str(), theFather);
}
}

View File

@ -0,0 +1,97 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef ADVANCEDGUI_PIPETSHAPEDLG_H
#define ADVANCEDGUI_PIPETSHAPEDLG_H
#include <GEOMBase_Skeleton.h>
class DlgRef_1Spin;
class DlgRef_2Spin;
class DlgRef_3Spin;
class DlgRef_3Sel;
class DlgRef_6Sel;
class DlgRef_PipeTShape_ScrollArea;
class QCheckBox;
class QLineEdit;
//=================================================================================
// class : AdvancedGUI_PipeTShapeDlg
// purpose :
//=================================================================================
class AdvancedGUI_PipeTShapeDlg: public GEOMBase_Skeleton {
Q_OBJECT
public:
AdvancedGUI_PipeTShapeDlg(GeometryGUI*, QWidget* = 0);
~AdvancedGUI_PipeTShapeDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid(QString&);
virtual bool execute(ObjectList&);
virtual void restoreSubShapes(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
private:
void Init();
void enterEvent(QEvent*);
bool CheckCompatiblePosition(GEOM::GEOM_Object_var theP1,
GEOM::GEOM_Object_var theP2,
GEOM::GEOM_Object_var theP3, double theTolerance);
private:
QPixmap imagePipeTShape;
DlgRef_PipeTShape_ScrollArea* PictureView;
DlgRef_3Spin* MainTubeGroupParams;
DlgRef_3Spin* IncidentTubeGroupParams;
DlgRef_2Spin* ChamferGroupParams;
DlgRef_1Spin* FilletGroupParams;
DlgRef_6Sel* JunctionPointsSel;
// QLineEdit* NewPosValL1;
// QLineEdit* NewPosValL2;
// QPushButton* ApplyNewL1;
// QPushButton* ApplyNewL2;
QCheckBox* HexMeshCheckBox;
GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3;
bool myOkPoint1, myOkPoint2, myOkPoint3;
bool isPreview;
ObjectList pipeTShapeGroupObjects;
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void DisplayPreview(const bool activate = false, const bool update = true,
const bool toRemoveFromEngine = true, const double lineWidth = -1,
const int displayMode = -1, const int color = -1);
void SetPosition(bool);
void ChamferOrFillet(bool);
void SetDoubleSpinBoxStep(double);
void ValueChangedInSpinBox( double );
void UpdatePicture(QWidget* old, QWidget* now);
void ApplyNewDimensions();
bool executeNoCheck( ObjectList& objects );
};
#endif // ADVANCEDGUI_PIPETSHAPEDLG_H

View File

@ -30,6 +30,7 @@ salomeinclude_HEADERS = \
AdvancedGUI.h
ADVANCED_INCLUDES =
ADVANCED_INCLUDES += AdvancedGUI_PipeTShapeDlg.h
##@@ insert new functions before this line @@##
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
@ -42,6 +43,7 @@ dist_libAdvancedGUI_la_SOURCES = \
AdvancedGUI.cxx
ADVANCED_SOURCES =
ADVANCED_SOURCES += AdvancedGUI_PipeTShapeDlg.h AdvancedGUI_PipeTShapeDlg.cxx
##@@ insert new functions before this line @@##
dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES)
@ -49,6 +51,7 @@ dist_libAdvancedGUI_la_SOURCES += $(ADVANCED_SOURCES)
MOC_FILES =
ADVANCED_MOC_FILES =
ADVANCED_MOC_FILES += AdvancedGUI_PipeTShapeDlg_moc.cxx
##@@ insert new functions before this line @@##
MOC_FILES += $(ADVANCED_MOC_FILES)

View File

@ -772,6 +772,20 @@ DlgRef_Skeleton::~DlgRef_Skeleton()
{
}
//////////////////////////////////////////
// DlgRef_PipeTShape_ScrollArea
//////////////////////////////////////////
DlgRef_PipeTShape_ScrollArea::DlgRef_PipeTShape_ScrollArea( QWidget* parent, Qt::WindowFlags f )
: QWidget( parent, f )
{
setupUi( this );
}
DlgRef_PipeTShape_ScrollArea::~DlgRef_PipeTShape_ScrollArea()
{
}
//////////////////////////////////////////
// Utility functions
//////////////////////////////////////////

View File

@ -843,6 +843,22 @@ public:
~DlgRef_Skeleton();
};
//////////////////////////////////////////
// DlgRef_PipeTShape_ScrollArea
//////////////////////////////////////////
#include "ui_DlgRef_PipeTShape_ScrollArea_QTD.h"
class DLGREF_EXPORT DlgRef_PipeTShape_ScrollArea : public QWidget,
public Ui::DlgRef_PipeTShape_ScrollArea_QTD
{
Q_OBJECT
public:
DlgRef_PipeTShape_ScrollArea( QWidget* = 0, Qt::WindowFlags = 0 );
~DlgRef_PipeTShape_ScrollArea();
};
//////////////////////////////////////////
// Utility functions
//////////////////////////////////////////

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgRef_PipeTShape_ScrollArea_QTD</class>
<widget class="QWidget" name="DlgRef_PipeTShape_ScrollArea_QTD">
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QScrollArea" name="ScrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>250</height>
</size>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>110</width>
<height>246</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="PipeTShape">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -89,6 +89,12 @@ UIC_FILES = \
ui_DlgRef_6Sel_QTD.h \
ui_DlgRef_Skeleton_QTD.h
ADVANCED_UIC_FILES =
ADVANCED_UIC_FILES += ui_DlgRef_PipeTShape_ScrollArea_QTD.h
##@@ insert new functions before this line @@##
UIC_FILES += $(ADVANCED_UIC_FILES)
BUILT_SOURCES = $(UIC_FILES)
nodist_libDlgRef_la_SOURCES = \

View File

@ -1077,6 +1077,131 @@
<source>ICON_DLG_SCALE_ALONG_AXES</source>
<translation>scale_along_axes.png</translation>
</message>
<message>
<source>ICON_DLG_PIPETSHAPE</source>
<translation>pipetshape.png</translation>
</message>
<message>
<source>ICO_PIPETSHAPE</source>
<translation>pipetshape.png</translation>
</message>
<message>
<source>ICO_PIPETSHAPE_IMPORT</source>
<translation>pipetshape_import_icon.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE</source>
<translation>dlg_pipetshape.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_L1</source>
<translation>dlg_pipetshapel1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_R1</source>
<translation>dlg_pipetshaper1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_W1</source>
<translation>dlg_pipetshapew1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_L2</source>
<translation>dlg_pipetshapel2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_R2</source>
<translation>dlg_pipetshaper2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_W2</source>
<translation>dlg_pipetshapew2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET</source>
<translation>dlg_pipetshapefillet.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET_L1</source>
<translation>dlg_pipetshapefilletl1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET_R1</source>
<translation>dlg_pipetshapefilletr1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET_W1</source>
<translation>dlg_pipetshapefilletw1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET_L2</source>
<translation>dlg_pipetshapefilletl2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET_R2</source>
<translation>dlg_pipetshapefilletr2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET_W2</source>
<translation>dlg_pipetshapefilletw2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_FILLET_RF</source>
<translation>dlg_pipetshapefilletrf.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER</source>
<translation>dlg_pipetshapechamfer.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_L1</source>
<translation>dlg_pipetshapechamferl1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_R1</source>
<translation>dlg_pipetshapechamferr1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_W1</source>
<translation>dlg_pipetshapechamferw1.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_L2</source>
<translation>dlg_pipetshapechamferl2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_R2</source>
<translation>dlg_pipetshapechamferr2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_W2</source>
<translation>dlg_pipetshapechamferw2.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_H</source>
<translation>dlg_pipetshapechamferh.png</translation>
</message>
<message>
<source>DLG_PIPETSHAPE_CHAMFER_W</source>
<translation>dlg_pipetshapechamferw.png</translation>
</message>
<message>
<source>ICON_OBJBROWSER_ADVANCED_201</source>
<translation>tree_pipetshape.png</translation>
</message>
<!--
<message>
<source>ICON_DLG_PIPETSHAPEGROUPS</source>
<translation>pipetshapegroups.png</translation>
</message>
<message>
<source>ICO_PIPETSHAPEGROUPS</source>
<translation>pipetshapegroups.png</translation>
</message>
-->
<!-- @@ insert new functions before this line @@ -->
</context>
</TS>

View File

@ -4497,5 +4497,143 @@ Would you like to continue?</translation>
<translation>Load Texture</translation>
</message>
</context>
<context>
<name>AdvancedGUI_PipeTShapeDlg</name>
<message>
<source>GEOM_PIPE_TSHAPE_TITLE</source>
<translation>Pipe TShape Construction</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE</source>
<translation>PipeTShape</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_MPIPE</source>
<translation>Main pipe</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_R</source>
<translation>Radius</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_W</source>
<translation>Width</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_L</source>
<translation>Half-length</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_IPIPE</source>
<translation>Incident pipe</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_CHAMFER</source>
<translation>Chamfer</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_CHAMFER_H</source>
<translation>Height</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_CHAMFER_W</source>
<translation>Width</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_FILLET</source>
<translation>Fillet</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_HEX</source>
<translation>Prepare for hex mesh</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION</source>
<translation>Set position</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION_P1</source>
<translation>Junction P1</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION_P2</source>
<translation>Junction P2</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION_P3</source>
<translation>Junction P3</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
<translation>New L1</translation>
</message>
<message>
<source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
<translation>New L2</translation>
</message>
</context>
<context>
<name>@default</name>
<message>
<source>TOP_PIPETSHAPE</source>
<translation>Create Pipe TShape</translation>
</message>
<message>
<source>MEN_PIPETSHAPE</source>
<translation>Pipe TShape</translation>
</message>
<message>
<source>STB_PIPETSHAPE</source>
<translation>Create new Pipe TShape object</translation>
</message>
<message>
<source>GEOM_ADVANCED_201</source>
<translation>Pipe TShape</translation>
</message>
<message>
<source>HALF_LENGTH_MAIN_PIPE</source>
<translation>Main pipe half length</translation>
</message>
<message>
<source>HALF_LENGTH_INCIDENT_PIPE</source>
<translation>Incident pipe half length</translation>
</message>
<message>
<source>CIRCULAR_QUARTER_PIPE</source>
<translation>Circular quarter of pipe</translation>
</message>
<message>
<source>THICKNESS</source>
<translation>Thickness</translation>
</message>
<message>
<source>FLANGE</source>
<translation>Flange</translation>
</message>
<message>
<source>CHAMFER_OR_FILLET</source>
<translation>Chamfer or fillet</translation>
</message>
<message>
<source>CHAMFER</source>
<translation>Chamfer</translation>
</message>
<message>
<source>FILLET</source>
<translation>Fillet</translation>
</message>
<message>
<source>JUNCTION_FACE_1</source>
<translation>Junction 1</translation>
</message>
<message>
<source>JUNCTION_FACE_2</source>
<translation>Junction 2</translation>
</message>
<message>
<source>JUNCTION_FACE_3</source>
<translation>Junction 3</translation>
</message>
</context>
<!-- @@ insert new functions before this line @@ -->
</TS>

View File

@ -501,6 +501,8 @@ void GeometryGUI::OnGUIEvent( int id )
libName = "BlocksGUI";
break;
case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
// case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
//@@ insert new functions before this line @@//
libName = "AdvancedGUI";
break;
@ -729,6 +731,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" );
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
//@@ insert new functions before this line @@//
// ---- create menus --------------------------
@ -772,6 +776,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::OpPipe, genId, -1 );
int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
createMenu( GEOMOp::OpPipeTShape, advId, -1 );
// createMenu( GEOMOp::OpPipeTShapeGroups, advId, -1 );
//@@ insert new functions before this line @@//
createMenu( separator(), newEntId, -1 );
@ -977,6 +983,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::OpCompound, buildTbId );
int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
createTool( GEOMOp::OpPipeTShape, advancedTbId );
//@@ insert new functions before this line @@//
// ---- create popup menus --------------------------
@ -1049,30 +1056,30 @@ void GeometryGUI::initialize( CAM_Application* app )
QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)";
int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu
mgr->insert( action(GEOMOp::OpSelectVertex), selectolnyId, -1); //Vertex
int selectonlyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu
mgr->insert( action(GEOMOp::OpSelectVertex), selectonlyId, -1); //Vertex
mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectEdge), selectolnyId, -1); //Edge
mgr->insert( action(GEOMOp::OpSelectEdge), selectonlyId, -1); //Edge
mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectWire), selectolnyId, -1); //Wire
mgr->insert( action(GEOMOp::OpSelectWire), selectonlyId, -1); //Wire
mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectFace), selectolnyId, -1); //Face
mgr->insert( action(GEOMOp::OpSelectFace), selectonlyId, -1); //Face
mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectShell), selectolnyId, -1); //Shell
mgr->insert( action(GEOMOp::OpSelectShell), selectonlyId, -1); //Shell
mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectSolid), selectolnyId, -1); //Solid
mgr->insert( action(GEOMOp::OpSelectSolid), selectonlyId, -1); //Solid
mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpSelectCompound), selectolnyId, -1); //Compound
mgr->insert( action(GEOMOp::OpSelectCompound), selectonlyId, -1); //Compound
mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule);
mgr->insert( separator(), selectolnyId, -1);
mgr->insert( action(GEOMOp::OpSelectAll), selectolnyId, -1); //Clear selection filter
mgr->insert( separator(), selectonlyId, -1);
mgr->insert( action(GEOMOp::OpSelectAll), selectonlyId, -1); //Clear selection filter
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly, QtxPopupMgr::VisibleRule);
mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only

View File

@ -158,6 +158,8 @@ namespace GEOMOp {
OpExplodeBlock = 6104, // MENU BLOCKS - EXPLODE ON BLOCKS
// AdvancedGUI ---------------//--------------------------------
OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base)
OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
// OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
//@@ insert new functions before this line @@//
};
}

View File

@ -80,6 +80,7 @@
#include <GEOMImpl_GlueDriver.hxx>
#include <GEOMImpl_MeasureDriver.hxx>
// Advanced operations
#include <GEOMImpl_PipeTShapeDriver.hxx>
/*@@ insert new functions before this line @@*/
//=============================================================================
@ -161,6 +162,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver());
// Advanced operations
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver());
/*@@ insert new functions before this line @@*/
SetEngine(this);

File diff suppressed because it is too large Load Diff

View File

@ -31,13 +31,51 @@
#include "GEOM_Engine.hxx"
#include "GEOM_Object.hxx"
class GEOMImpl_IAdvancedOperations : public GEOM_IOperations
{
public:
Standard_EXPORT GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_IAdvancedOperations();
#define Handle_GEOM_Object Handle(GEOM_Object)
#define Handle_TColStd_HSequenceOfTransient Handle(TColStd_HSequenceOfTransient)
#define Handle_TColStd_HSequenceOfInteger Handle(TColStd_HSequenceOfInteger)
class GEOMImpl_IAdvancedOperations: public GEOM_IOperations {
private:
bool MakePipeTShapePartition(/*std::vector<GEOM_IOperations*> theOperations, */Handle_GEOM_Object theShape, double theR1, double theW1, double theL1, double theR2,
double theW2, double theL2, double theH = 0, double theW = 0, double theRF = 0, bool isNormal = true);
bool MakePipeTShapeMirrorAndGlue(/*std::vector<GEOM_IOperations*> theOperations, */Handle_GEOM_Object theShape, double theR1, double theW1, double theL1, double theR2,
double theW2, double theL2);
bool MakeGroups(/*std::vector<GEOM_IOperations*> theOperations, */Handle_GEOM_Object theShape, int shapType, double theR1, double theW1, double theL1, double theR2,
double theW2, double theL2, Handle_TColStd_HSequenceOfTransient theSeq, gp_Trsf aTrsf);
gp_Trsf GetPositionTrsf(double theL1, double theL2, Handle_GEOM_Object P1 = NULL, Handle_GEOM_Object P2 = NULL,
Handle_GEOM_Object P3 = NULL);
bool CheckCompatiblePosition(double& theL1, double& theL2, Handle_GEOM_Object theP1, Handle_GEOM_Object theP2,
Handle_GEOM_Object theP3, double theTolerance);
public:
Standard_EXPORT
GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID);Standard_EXPORT
~GEOMImpl_IAdvancedOperations();
Standard_EXPORT Handle_TColStd_HSequenceOfTransient MakePipeTShape(double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2, bool theHexMesh = true);
Standard_EXPORT Handle_TColStd_HSequenceOfTransient
MakePipeTShapeWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2, double theL2,
bool theHexMesh = true, Handle_GEOM_Object P1 = NULL, Handle_GEOM_Object P2 = NULL, Handle_GEOM_Object P3 =
NULL);
Standard_EXPORT Handle_TColStd_HSequenceOfTransient MakePipeTShapeChamfer(double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2, double theH, double theW, bool theHexMesh = true);
Standard_EXPORT Handle_TColStd_HSequenceOfTransient
MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2,
double theL2, double theH, double theW, bool theHexMesh = true, Handle_GEOM_Object P1 = NULL,
Handle_GEOM_Object P2 = NULL, Handle_GEOM_Object P3 = NULL);
Standard_EXPORT Handle_TColStd_HSequenceOfTransient MakePipeTShapeFillet(double theR1, double theW1, double theL1,
double theR2, double theW2, double theL2, double theRF, bool theHexMesh = true);
Standard_EXPORT Handle_TColStd_HSequenceOfTransient
MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1, double theR2, double theW2,
double theL2, double theRF, bool theHexMesh = true, Handle_GEOM_Object P1 = NULL, Handle_GEOM_Object P2 =
NULL, Handle_GEOM_Object P3 = NULL);
/*@@ insert new functions before this line @@*/
};
#undef Handle_GEOM_Object
#undef Handle_TColStd_HSequenceOfTransient
#undef Handle_TColStd_HSequenceOfInteger
#endif

View File

@ -0,0 +1,97 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef _GEOMImpl_IPipeTShape_HXX_
#define _GEOMImpl_IPipeTShape_HXX_
#include "GEOM_Function.hxx"
#define TSHAPE_ARG_R1 1
#define TSHAPE_ARG_W1 2
#define TSHAPE_ARG_L1 3
#define TSHAPE_ARG_R2 4
#define TSHAPE_ARG_W2 5
#define TSHAPE_ARG_L2 6
// chamfer
#define TSHAPE_ARG_H 7
#define TSHAPE_ARG_W 8
// fillet
#define TSHAPE_ARG_RF 9
// partition
#define TSHAPE_ARG_HEXMESH 10
// junction points
#define TSHAPE_ARG_P1 11
#define TSHAPE_ARG_P2 12
#define TSHAPE_ARG_P3 13
class GEOMImpl_IPipeTShape
{
public:
GEOMImpl_IPipeTShape(Handle(GEOM_Function) theFunction): _func(theFunction) {}
void SetR1(double theR1) { _func->SetReal(TSHAPE_ARG_R1, theR1); }
double GetR1() { return _func->GetReal(TSHAPE_ARG_R1); }
void SetW1(double theW1) { _func->SetReal(TSHAPE_ARG_W1, theW1); }
double GetW1() { return _func->GetReal(TSHAPE_ARG_W1); }
void SetL1(double theL1) { _func->SetReal(TSHAPE_ARG_L1, theL1); }
double GetL1() { return _func->GetReal(TSHAPE_ARG_L1); }
void SetR2(double theR2) { _func->SetReal(TSHAPE_ARG_R2, theR2); }
double GetR2() { return _func->GetReal(TSHAPE_ARG_R2); }
void SetW2(double theW2) { _func->SetReal(TSHAPE_ARG_W2, theW2); }
double GetW2() { return _func->GetReal(TSHAPE_ARG_W2); }
void SetL2(double theL2) { _func->SetReal(TSHAPE_ARG_L2, theL2); }
double GetL2() { return _func->GetReal(TSHAPE_ARG_L2); }
void SetH(double theH) { _func->SetReal(TSHAPE_ARG_H, theH); }
double GetH() { return _func->GetReal(TSHAPE_ARG_H); }
void SetW(double theW) { _func->SetReal(TSHAPE_ARG_W, theW); }
double GetW() { return _func->GetReal(TSHAPE_ARG_W); }
void SetRF(double theRF) { _func->SetReal(TSHAPE_ARG_RF, theRF); }
double GetRF() { return _func->GetReal(TSHAPE_ARG_RF); }
void SetHexMesh(int theHexMesh) { _func->SetInteger(TSHAPE_ARG_HEXMESH, theHexMesh); }
int GetHexMesh() { return _func->GetInteger(TSHAPE_ARG_HEXMESH); }
void SetP1(const Handle(GEOM_Function)& theP1){_func->SetReference(TSHAPE_ARG_P1, theP1); }
Handle(GEOM_Function) GetP1() { return _func->GetReference(TSHAPE_ARG_P1); }
void SetP2(const Handle(GEOM_Function)& theP2){_func->SetReference(TSHAPE_ARG_P2, theP2); }
Handle(GEOM_Function) GetP2() { return _func->GetReference(TSHAPE_ARG_P2); }
void SetP3(const Handle(GEOM_Function)& theP3){_func->SetReference(TSHAPE_ARG_P3, theP3); }
Handle(GEOM_Function) GetP3() { return _func->GetReference(TSHAPE_ARG_P3); }
private:
Handle(GEOM_Function) _func;
};
#endif // _GEOMImpl_IPipeTShape_HXX_

View File

@ -0,0 +1,673 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#include <Standard_Stream.hxx>
#include <GEOMImpl_PipeTShapeDriver.hxx>
#include <GEOMImpl_IPipeTShape.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
#include <GEOM_Function.hxx>
#include <GEOMImpl_IShapesOperations.hxx>
#include "GEOMAlgo_FinderShapeOn1.hxx"
#include "GEOMAlgo_FinderShapeOn2.hxx"
#include <GEOMAlgo_ClsfBox.hxx>
#include <GEOMAlgo_Gluer.hxx>
#include <TFunction_Logbook.hxx>
#include <StdFail_NotDone.hxx>
// Partition includes
#include <GEOMAlgo_Splitter.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Ax2.hxx>
#include <gp_Pln.hxx>
#include <gp_Dir.hxx>
#include <gp_Trsf.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAlgoAPI_Fuse.hxx>
#include <BRepAlgoAPI_Cut.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
#include <BRepFilletAPI_MakeChamfer.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <TopoDS.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <vector>
//@@ include required header files here @@//
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& GEOMImpl_PipeTShapeDriver::GetID()
{
static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
return aGUID;
}
//=======================================================================
//function : GEOMImpl_PipeTShapeDriver
//purpose :
//=======================================================================
GEOMImpl_PipeTShapeDriver::GEOMImpl_PipeTShapeDriver()
{
}
//=======================================================================
//function : getShapesOnBoxIDs
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theBox - the box to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
//=======================================================================
Handle(TColStd_HSequenceOfInteger)
GEOMImpl_PipeTShapeDriver::GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
const TopoDS_Shape& aShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState) const
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
if (!GEOMImpl_IShapesOperations::CheckTriangulation(aShape)) {
StdFail_NotDone::Raise("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
// Call algo
GEOMAlgo_FinderShapeOn2 aFinder;
Standard_Real aTol = 0.0001; // default value
Handle(GEOMAlgo_ClsfBox) aClsfBox = new GEOMAlgo_ClsfBox;
aClsfBox->SetBox(aBox);
aFinder.SetShape(aShape);
aFinder.SetTolerance(aTol);
aFinder.SetClsf(aClsfBox);
aFinder.SetShapeType( (TopAbs_ShapeEnum)theShapeType );
aFinder.SetState(theState);
aFinder.Perform();
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
// the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
if (iErr) {
TCollection_AsciiString aMsg (" iErr : ");
aMsg += TCollection_AsciiString(iErr);
StdFail_NotDone::Raise(aMsg.ToCString());
return aSeqOfIDs;
}
const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
if (listSS.Extent() < 1) {
StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
return aSeqOfIDs;
}
// Fill sequence of object IDs
aSeqOfIDs = new TColStd_HSequenceOfInteger;
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices);
TopTools_ListIteratorOfListOfShape itSub (listSS);
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
int id = anIndices.FindIndex(itSub.Value());
std::cerr << "Shape with ID " << id << " found" << std::endl;
// TopoDS_Shape s = anIndices.FindKey(id);
aSeqOfIDs->Append(id);
// aSeqOfIDs->Append(itSub.Value());
}
return aSeqOfIDs;
}
//=======================================================================
//function : GetShapesOnSurfaceIDs
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theSurface - the surface to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
//=======================================================================
Handle(TColStd_HSequenceOfInteger)
GEOMImpl_PipeTShapeDriver::GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
const TopoDS_Shape& theShape,
TopAbs_ShapeEnum theShapeType,
GEOMAlgo_State theState) const
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
if (!GEOMImpl_IShapesOperations::CheckTriangulation(theShape)) {
StdFail_NotDone::Raise("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
// Call algo
GEOMAlgo_FinderShapeOn1 aFinder;
Standard_Real aTol = 1e-6;
aFinder.SetShape(theShape);
aFinder.SetTolerance(aTol);
aFinder.SetSurface(theSurface);
aFinder.SetShapeType(theShapeType);
aFinder.SetState(theState);
// Sets the minimal number of inner points for the faces that do not have own
// inner points at all (for e.g. rectangular planar faces have just 2 triangles).
// Default value=3
aFinder.SetNbPntsMin(3);
// Sets the maximal number of inner points for edges or faces.
// It is usefull for the cases when this number is very big (e.g =2000) to improve
// the performance. If this value =0, all inner points will be taken into account.
// Default value=0
aFinder.SetNbPntsMax(0);
aFinder.Perform();
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
// the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
if (iErr) {
// MESSAGE(" iErr : " << iErr);
TCollection_AsciiString aMsg (" iErr : ");
aMsg += TCollection_AsciiString(iErr);
StdFail_NotDone::Raise(aMsg.ToCString());
return aSeqOfIDs;
}
// Standard_Integer iWrn = aFinder.WarningStatus();
// the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
// if (iWrn) {
// MESSAGE(" *** iWrn : " << iWrn);
// }
const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
if (listSS.Extent() < 1) {
//StdFail_NotDone::Raise("Not a single sub-shape of the requested type found on the given surface");
StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
return aSeqOfIDs;
}
// Fill sequence of object IDs
aSeqOfIDs = new TColStd_HSequenceOfInteger;
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(theShape, anIndices);
TopTools_ListIteratorOfListOfShape itSub (listSS);
for (int index = 1; itSub.More(); itSub.Next(), ++index) {
int id = anIndices.FindIndex(itSub.Value());
aSeqOfIDs->Append(id);
}
return aSeqOfIDs;
}
//=======================================================================
//function : GetCommonShapesOnCylinders
//purpose : return the common shapes between 2 cylindrical surfaces
// along OX and OZ
//=======================================================================
void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
TopAbs_ShapeEnum theShapeType,
double r1,
double r2,
Handle(TopTools_HSequenceOfShape)& commonShapes) const
{
gp_Pnt aP0 (0, 0, 0);
gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
gp_Ax3 anAxis1 (aP0, aVX), anAxis2 (aP0, aVZ);
TopTools_IndexedMapOfShape aMapOfShapes;
aMapOfShapes.Clear();
TopExp::MapShapes(theShape, aMapOfShapes);
commonShapes->Clear();
int myID;
bool found = false;
// Create a cylinder surface
Handle(Geom_Surface) aC1Ext = new Geom_CylindricalSurface(anAxis1, r1);
if ( aC1Ext.IsNull() )
StdFail_NotDone::Raise("Couldn't build main cylindrical surface");
// Find object IDs
Handle(TColStd_HSequenceOfInteger) aSeqExt1 = GetShapesOnSurfaceIDs( aC1Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
// Create a cylinder surface
Handle(Geom_Surface) aC2Ext = new Geom_CylindricalSurface(anAxis2, r2);
if ( aC2Ext.IsNull() )
StdFail_NotDone::Raise("Couldn't build incident cylindrical surface");
// Find object IDs
Handle(TColStd_HSequenceOfInteger) aSeqExt2 = GetShapesOnSurfaceIDs( aC2Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
// # Recherche (dans le quart de Te) de l'arete d'intersection des 2 cylindres
// # Search in theShape for common shape of type theShapeType on the intersection of 2 pipes
found = false;
for (int i=1; i<=aSeqExt2->Length();i++) {
std::cerr << "aSeqExt2->Value(i): " << aSeqExt2->Value(i) << std::endl;
for (int j=1; j<=aSeqExt1->Length();j++) {
std::cerr << "aSeqExt1->Value(j): " << aSeqExt1->Value(j) << std::endl;
if (aSeqExt1->Value(j) == aSeqExt2->Value(i)) {
myID = aSeqExt1->Value(j);
commonShapes->Append(aMapOfShapes.FindKey(myID));
found = true;
}
}
}
if (!found)
StdFail_NotDone::Raise("Common shapes couldn't be found");
}
//=======================================================================
//function : MakePipeTShape
//purpose :
//=======================================================================
TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape(const double r1, const double w1, const double l1,
const double r2, const double w2, const double l2) const
{
double r1Ext = r1 + w1;
double r2Ext = r2 + w2;
gp_Pnt aP0 (0, 0, 0);
gp_Pnt aP1 (-l1, 0, 0);
gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
gp_Ax2 anAxes1 (aP1, aVX);
gp_Ax2 anAxes2 (aP0, aVZ);
// Build the initial pipes
BRepPrimAPI_MakeCylinder C1Int (anAxes1, r1, Abs(2 * l1));
BRepPrimAPI_MakeCylinder C1Ext (anAxes1, r1Ext, Abs(2 * l1));
BRepPrimAPI_MakeCylinder C2Int (anAxes2, r2, Abs(l2));
BRepPrimAPI_MakeCylinder C2Ext (anAxes2, r2Ext, Abs(l2));
C1Int.Build();
C1Ext.Build();
C2Int.Build();
C2Ext.Build();
if (!C1Int.IsDone() || !C1Ext.IsDone() || !C2Int.IsDone() || !C2Ext.IsDone()) {
StdFail_NotDone::Raise("Couldn't build cylinders");
}
// Fuse the 2 pipes
BRepAlgoAPI_Fuse fuse1 (C1Ext.Shape(), C2Ext.Shape());
if (!fuse1.IsDone()) {
StdFail_NotDone::Raise("Couldn't fuse cylinders");
}
// Remove small radius main pipe
BRepAlgoAPI_Cut cut1 (fuse1.Shape(), C1Int.Shape());
if (!cut1.IsDone()) {
StdFail_NotDone::Raise("Coudn't cut cylinders");
}
// Remove small radius incident pipe => Te
BRepAlgoAPI_Cut Te (cut1.Shape(), C2Int.Shape());
if (!Te.IsDone()) {
StdFail_NotDone::Raise("Coudn't cut cylinders");
}
return Te.Shape();
}
//=======================================================================
//function : MakeQuarterPipeTShape
//purpose :
//=======================================================================
TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakeQuarterPipeTShape(const double r1, const double w1, const double l1,
const double r2, const double w2, const double l2) const
{
double r1Ext = r1 + w1;
TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2);
if (Te.IsNull())
StdFail_NotDone::Raise("Couldn't build Pipe TShape");
// Get a quarter of shape => Te2
BRepPrimAPI_MakeBox box1 (gp_Pnt(0,-2*r1Ext,-2*r1Ext),gp_Pnt(Abs(2 * l1), 2*r1Ext, Abs(2*l2)));
BRepPrimAPI_MakeBox box2 (gp_Pnt(0,2*r1Ext,-2*r1Ext),gp_Pnt(-Abs(2 * l1), 0, Abs(2*l2)));
box1.Build();
box2.Build();
if (!box1.IsDone() || !box2.IsDone()) {
StdFail_NotDone::Raise("Couldn't build boxes");
}
BRepAlgoAPI_Cut cut3 (Te, box1.Shape());
if (!cut3.IsDone()) {
StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
}
BRepAlgoAPI_Cut Te4 (cut3.Shape(), box2.Shape());
if (!Te4.IsDone()) {
StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
}
return Te4.Shape();
}
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_PipeTShapeDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IPipeTShape aData (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape, Te4, Te4Part;
// TopoDS_Edge arete_intersect_int;
// Handle(TopTools_HSequenceOfShape) edges_e = new TopTools_HSequenceOfShape;
Handle(TColStd_HSequenceOfInteger) edges_e;
// Handle(TopTools_HSequenceOfShape) edges_i = new TopTools_HSequenceOfShape;
// gp_Pnt aP0 (0, 0, 0);
// gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
bool hexMesh = (bool) aData.GetHexMesh();
// Useful values
// double aSize = 2*(aData.GetL1() + aData.GetL2());
double epsilon = Precision::Approximation();
double aR1Ext = aData.GetR1() + aData.GetW1();
double aR2Ext = aData.GetR2() + aData.GetW2();
if (aData.GetR2() > aData.GetR1() + epsilon) {
std::cerr << "aData.GetR1(): " << aData.GetR1() << std::endl;
std::cerr << "aData.GetR2(): " << aData.GetR2() << std::endl;
StdFail_NotDone::Raise("TShape cannot be computed if R2 > R1");
}
if (aR2Ext > aR1Ext + epsilon) {
std::cerr << "aR1Ext: " << aR1Ext << std::endl;
std::cerr << "aR2Ext: " << aR2Ext << std::endl;
StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 > R1+W1");
}
// external radius are equal
if (fabs(aR2Ext - aR1Ext) < epsilon) {
if (aType == TSHAPE_CHAMFER)
StdFail_NotDone::Raise("TShape with chamfer cannot be computed if R2+W2 = R1+W1");
if (aType == TSHAPE_FILLET)
StdFail_NotDone::Raise("TShape with fillet cannot be computed if R2+W2 = R1+W1");
// internal radius are different => not possible
if (fabs(aData.GetR2() - aData.GetR1()) > epsilon) {
std::cerr << "R1Ext: " << aR1Ext << std::endl;
std::cerr << "R2Ext: " << aR2Ext << std::endl;
std::cerr << "R1: " << aData.GetR1() << std::endl;
std::cerr << "R2: " << aData.GetR2() << std::endl;
StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 = R1+W1 and R2 != R1");
}
}
if (aR1Ext >= aData.GetL2() + epsilon) {
StdFail_NotDone::Raise("TShape cannot be computed if R1+W1 >= L2");
}
if (aR2Ext >= aData.GetL1() + epsilon) {
StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 >= L1");
}
if (aType == TSHAPE_CHAMFER) {
if (aData.GetH() >= (aData.GetL2() - aR1Ext + epsilon)) {
std::cerr << "H: " << aData.GetH() << std::endl;
std::cerr << "L2: " << aData.GetL2() << std::endl;
std::cerr << "R1Ext: " << aR1Ext << std::endl;
std::cerr << "aData.GetL2() - aR1Ext: " << aData.GetL2() - aR1Ext << std::endl;
StdFail_NotDone::Raise("TShape cannot be computed: height of chamfer is too high");
}
if (aData.GetW() >= (aData.GetL1() - aR2Ext + epsilon))
StdFail_NotDone::Raise("TShape cannot be computed: width of chamfer is too high");
}
if (aType == TSHAPE_FILLET) {
if (aData.GetRF() >= (aData.GetL2() - aR1Ext + epsilon) ||
aData.GetRF() >= (aData.GetL1() - aR2Ext + epsilon))
StdFail_NotDone::Raise("TShape cannot be computed: radius of fillet is too high");
}
if (hexMesh) {
// Create a quarter of a basic T-Shape pipe
std::cerr << "Create a quarter of a basic T-Shape pipe" << std::endl;
Te4 = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
aData.GetR2(), aData.GetW2(), aData.GetL2());
}
else {
// No need to cut pipe t-shape
std::cerr << "Create a basic T-Shape pipe" << std::endl;
Te4 = MakePipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
aData.GetR2(), aData.GetW2(), aData.GetL2());
}
aShape = Te4;
/*
if (aType == TSHAPE_BASIC) {
aShape = Te4;
// aShape = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
// aData.GetR2(), aData.GetW2(), aData.GetL2());
}
else if (aType == TSHAPE_CHAMFER) {
// TShape with chamfer
// BRep_Builder BB;
// TopoDS_Compound CC;
// BB.MakeCompound(CC);
// Create chamfer on the edges edges_e
BRepFilletAPI_MakeChamfer chamfer (Te4);
TopTools_IndexedMapOfShape anEdgesIndices;
TopExp::MapShapes(Te4, anEdgesIndices);
TopoDS_Shape theBox;
if (hexMesh) {
BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
aBox.Build();
if (!aBox.IsDone()) {
StdFail_NotDone::Raise("Couldn't build box");
}
theBox = aBox.Shape();
}
else {
BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
aBox.Build();
if (!aBox.IsDone()) {
StdFail_NotDone::Raise("Couldn't build box");
}
theBox = aBox.Shape();
}
Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
if (edges_e.IsNull() || edges_e->Length() == 0) {
StdFail_NotDone::Raise("Common edges not found");
}
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(Te4, TopAbs_EDGE, TopAbs_FACE, M);
// std::cerr << "Number of IDs: " << edges_e->Length() << std::endl;
int nbEdgesInChamfer = 0;
for (int i=1;i<=edges_e->Length();i++) {
// std::cerr << "Get Edge with ID #" << i << std::endl;
int theId = edges_e->Value(i);
// std::cerr << "ID #" << i << "= " << theId << std::endl;
// std::cerr << "Search for edge in shape" << std::endl;
TopoDS_Edge theEdge = TopoDS::Edge(anEdgesIndices.FindKey(theId));
// std::cerr << "Found" << std::endl;
// std::cerr << "Keep only edges with a vertex on (x, x, re1)" << std::endl;
TopExp_Explorer ExVertices;
for (ExVertices.Init(theEdge,TopAbs_VERTEX); ExVertices.More(); ExVertices.Next()) {
gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(ExVertices.Current()));
if (aPt.Z() - aR1Ext <= epsilon) {
// std::cerr << "aPt.Z() = aR1Ext => keep this edge" << std::endl;
nbEdgesInChamfer ++;
const TopTools_ListOfShape& aFL = M.FindFromKey(theEdge);
TopoDS_Face F = TopoDS::Face( aFL.First() );
if (hexMesh)
chamfer.Add(aData.GetH(), aData.GetW(), theEdge, F);
else
chamfer.Add(aData.GetW(), aData.GetH(), theEdge, F);
break;
}
}
// std::cerr << "Test if hexMesh: ";
if (hexMesh && nbEdgesInChamfer == 1) {
// std::cerr << "Yes => stop after 1 edge" << std::endl;
break;
}
// std::cerr << "No => continue for other edges" << std::endl;
// BB.Add(CC, edges_e->Value(i));
// const TopTools_ListOfShape& aFL = M.FindFromKey(TopoDS::Edge(edges_e->Value(i)));
// chamfer.Add(aData.GetW(), aData.GetH(), TopoDS::Edge(edges_e->Value(i)), F);
}
// std::cerr << "Build chamfer with " << nbEdgesInChamfer << " edges" << std::endl;
// }
chamfer.Build();
if (!chamfer.IsDone()) {
StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters");
}
// BB.Add(CC, chamfer.Shape());
// aShape = CC;
aShape = chamfer.Shape();
}
else if (aType == TSHAPE_FILLET) {
// TShape with fillet
// Create fillet on the edge arete_intersect_ext
BRepFilletAPI_MakeFillet fill (Te4);
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(Te4, anIndices);
TopoDS_Shape theBox;
if (hexMesh) {
BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
aBox.Build();
if (!aBox.IsDone()) {
StdFail_NotDone::Raise("Couldn't build box");
}
theBox = aBox.Shape();
}
else {
BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
aBox.Build();
if (!aBox.IsDone()) {
StdFail_NotDone::Raise("Couldn't build box");
}
theBox = aBox.Shape();
}
Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
if (edges_e.IsNull() || edges_e->Length() == 0) {
StdFail_NotDone::Raise("Common edges not found");
}
// fill.Add(TopoDS::Edge(edges_e->Value(1)));
// if (!hexMesh) {
for (int i=1;i<=edges_e->Length();i++) {
if (hexMesh && (i > 1))
break;
TopoDS_Edge theEdge = TopoDS::Edge(anIndices.FindKey(edges_e->Value(i)));
fill.Add(theEdge);
// fill.Add(TopoDS::Edge(edges_e->Value(i)));
}
// }
fill.SetRadius(aData.GetRF(), 1, 1);
fill.Build();
if (!fill.IsDone()) {
StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
}
aShape = fill.Shape();
}
else {
// other construction modes here
}
*/
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
//=======================================================================
//function : GEOMImpl_PipeTShapeDriver_Type_
//purpose :
//=======================================================================
Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipeTShapeDriver",
sizeof(GEOMImpl_PipeTShapeDriver),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
//=======================================================================
//function : DownCast
//purpose :
//=======================================================================
const Handle(GEOMImpl_PipeTShapeDriver) Handle(GEOMImpl_PipeTShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMImpl_PipeTShapeDriver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipeTShapeDriver))) {
_anOtherObject = Handle(GEOMImpl_PipeTShapeDriver)((Handle(GEOMImpl_PipeTShapeDriver)&)AnObject);
}
}
return _anOtherObject;
}

View File

@ -0,0 +1,198 @@
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#ifndef _GEOMImpl_PipeTShapeDriver_HXX
#define _GEOMImpl_PipeTShapeDriver_HXX
#include <TFunction_Driver.hxx>
#include "GEOMAlgo_State.hxx"
#include <TopTools_ListOfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
#include <Handle_Geom_Surface.hxx>
class Handle_Standard_Type;
class GEOMImpl_PipeTShapeDriver;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
class Handle(GEOMImpl_PipeTShapeDriver) : public Handle(TFunction_Driver) {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
Handle(GEOMImpl_PipeTShapeDriver)():Handle(TFunction_Driver)() {}
Handle(GEOMImpl_PipeTShapeDriver)(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
{}
Handle(GEOMImpl_PipeTShapeDriver)(const GEOMImpl_PipeTShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
{}
Handle(GEOMImpl_PipeTShapeDriver)& operator=(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle)
{
Assign(aHandle.Access());
return *this;
}
Handle(GEOMImpl_PipeTShapeDriver)& operator=(const GEOMImpl_PipeTShapeDriver* anItem)
{
Assign((Standard_Transient *)anItem);
return *this;
}
GEOMImpl_PipeTShapeDriver* operator->()
{
return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
}
GEOMImpl_PipeTShapeDriver* operator->() const
{
return (GEOMImpl_PipeTShapeDriver *)ControlAccess();
}
Standard_EXPORT ~Handle(GEOMImpl_PipeTShapeDriver)() {};
Standard_EXPORT static const Handle(GEOMImpl_PipeTShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject);
};
class GEOMImpl_PipeTShapeDriver : public TFunction_Driver {
public:
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Methods PUBLIC
//
Standard_EXPORT GEOMImpl_PipeTShapeDriver();
Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
{
return Standard_True;
}
Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {};
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
{
return STANDARD_TYPE(GEOMImpl_PipeTShapeDriver);
}
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(GEOMImpl_PipeTShapeDriver) == AType || TFunction_Driver::IsKind(AType));
}
private:
/*!
* \brief Create a T-Shape based on pipes
* \param r1 - the internal radius of main pipe
* \param w1 - the thickness main pipe
* \param l1 - the half-length of main pipe
* \param r2 - the internal radius of incident pipe
* \param w2 - the thickness incident pipe
* \param l2 - the half-length of main pipe
* \retval TopoDS_Shape - Resulting shape
*/
TopoDS_Shape MakePipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
/*!
* \brief Create a quarter of a T-Shape based on pipes
* \param r1 - the internal radius of main pipe
* \param w1 - the thickness main pipe
* \param l1 - the half-length of main pipe
* \param r2 - the internal radius of incident pipe
* \param w2 - the thickness incident pipe
* \param l2 - the half-length of main pipe
* \retval TopoDS_Shape - Resulting shape
*/
TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1, double r2, double w2, double l2) const;
//=======================================================================
//function : GetShapesOnSurfaceIDs
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theSurface - the surface to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
Handle(TColStd_HSequenceOfInteger)
GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
const TopoDS_Shape& theShape,
TopAbs_ShapeEnum theShapeType,
GEOMAlgo_State theState) const;
//=======================================================================
//function : getShapesOnBoxIDs
/*!
* \brief Find IDs of subshapes complying with given status about surface
* \param theBox - the box to check state of subshapes against
* \param theShape - the shape to explore
* \param theShapeType - type of subshape of theShape
* \param theState - required state
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
*/
//=======================================================================
Handle(TColStd_HSequenceOfInteger)
GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
const TopoDS_Shape& aShape,
const Standard_Integer theShapeType,
GEOMAlgo_State theState) const;
//=======================================================================
//function : getCommonShapesOnCylinders
//purpose : return the common edge between 2 cylindrical surfaces
// along OX and OZ
//=======================================================================
void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
TopAbs_ShapeEnum theShapeType,
double r, double r2,
Handle(TopTools_HSequenceOfShape)& commonShapes) const;
};
#endif // _GEOMImpl_PipeTShapeDriver_HXX

View File

@ -302,7 +302,9 @@
// Advanced functions (base = 200)
#define ADVANCED_BASE 200 // NO OPERATION (advanced operations base)
/*@@ insert new functions before this line @@*/
#define GEOM_TSHAPE 201
// Advanced functions sub-operations codes
#define TSHAPE_BASIC 1
#define TSHAPE_CHAMFER 2
#define TSHAPE_FILLET 3
/*@@ insert new functions before this line @@*/

View File

@ -68,3 +68,5 @@ FF1BBB67-5D14-4df2-980B-3A668264EA16 // Blocks
FF1BBB68-5D14-4df2-980B-3A668264EA16 // Sub shape GUID
FF1BBB69-5D14-4df2-980B-3A668264EA16 // Modify the Location
1C3A0F3F-729D-4E83-8232-78E74FC5637C // Pipe T-Shape

View File

@ -147,6 +147,7 @@ salomeinclude_HEADERS = \
GEOM_GEOMImpl.hxx
ADVANCED_INCLUDES =
ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
##@@ insert new functions before this line @@##
salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
@ -215,6 +216,7 @@ dist_libGEOMimpl_la_SOURCES = \
GEOMImpl_GlueDriver.cxx
ADVANCED_SOURCES =
ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
##@@ insert new functions before this line @@##
dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)

View File

@ -55,4 +55,255 @@ GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i()
MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i");
}
//=============================================================================
/*!
* Create a T-shape object with specified caracteristics for the main and the
* incident pipes (radius, width, half-length).
* Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
//Create the TShape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//=============================================================================
/*!
* Create a T-shape object with specified caracteristics for the main and the
* incident pipes (radius, width, half-length).
* The T-shape is placed at junction points P1, P2 and P3.
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2, CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
//Get the reference vertices
Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
//Create the TShape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, aP1, aP2, aP3);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//=============================================================================
/*!
* Create a T-shape object with specified caracteristics for the main and the
* incident pipes (radius, width, half-length). A chamfer is created on
* the junction of the pipes.
* Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theH Height of the chamfer.
* \param theW Width of the chamfer.
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer(CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
//Create the TShape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//=============================================================================
/*!
* Create a T-shape object with specified caracteristics for the main and the
* incident pipes (radius, width, half-length). A chamfer is created on
* the junction of the pipes.
* The T-shape is placed at junction points P1, P2 and P3.
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theH Height of the chamfer.
* \param theW Width of the chamfer.
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
//Get the reference vertices
Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
//Create the TShape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW,
theHexMesh, aP1, aP2, aP3);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//=============================================================================
/*!
* Create a T-shape object with specified caracteristics for the main and the
* incident pipes (radius, width, half-length). A fillet is created on
* the junction of the pipes.
* Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theRF Radius of curvature of fillet.
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theRF, CORBA::Boolean theHexMesh)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
//Create the TShape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//=============================================================================
/*!
* Create a T-shape object with specified caracteristics for the main and the
* incident pipes (radius, width, half-length). A fillet is created on
* the junction of the pipes.
* The T-shape is placed at junction points P1, P2 and P3.
* \param theR1 Internal radius of main pipe
* \param theW1 Width of main pipe
* \param theL1 Half-length of main pipe
* \param theR2 Internal radius of incident pipe (R2 < R1)
* \param theW2 Width of incident pipe (R2+W2 < R1+W1)
* \param theL2 Half-length of incident pipe
* \param theRF Radius of curvature of fillet.
* \param theHexMesh false = no partition, true = with partition
* \return List of GEOM_Objects, containing the created shape and propagation groups.
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theRF, CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Set a not done flag
GetOperations()->SetNotDone();
//Get the reference vertices
Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
//Create the TShape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF,
theHexMesh, aP1, aP2, aP3);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
/*@@ insert new functions before this line @@*/

View File

@ -45,6 +45,27 @@ class GEOM_I_EXPORT GEOM_IAdvancedOperations_i :
::GEOMImpl_IAdvancedOperations* theImpl);
~GEOM_IAdvancedOperations_i();
GEOM::ListOfGO* MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Boolean theHexMesh);
GEOM::ListOfGO* MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
GEOM::ListOfGO* MakePipeTShapeChamfer (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh);
GEOM::ListOfGO* MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
GEOM::ListOfGO* MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theRF, CORBA::Boolean theHexMesh);
GEOM::ListOfGO* MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
CORBA::Double theRF, CORBA::Boolean theHexMesh,
GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
/*@@ insert new functions before this line @@*/
::GEOMImpl_IAdvancedOperations* GetOperations()

View File

@ -4134,6 +4134,92 @@ class geompyDC(GEOM._objref_GEOM_Gen):
## @addtogroup l4_advanced
## @{
## Create a T-shape object with specified caracteristics for the main
# and the incident pipes (radius, width, half-length).
# Center of the shape is (0,0,0). The main plane of the T-shape is
# XOY.
# @param theR1 Internal radius of main pipe
# @param theW1 Width of main pipe
# @param theL1 Half-length of main pipe
# @param theR2 Internal radius of incident pipe (R2 < R1)
# @param theW2 Width of incident pipe (R2+W2 < R1+W1)
# @param theL2 Half-length of incident pipe
# @param theHexMesh false = no partition, true = with partition (default=true)
# @param theP1 1st junction point of main pipe
# @param theP2 2nd junction point of main pipe
# @param theP3 Junction point of incident pipe
# @return List of GEOM_Objects, containing the created shape and propagation groups.
#
# @ref tui_creation_tshape "Example"
def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
theR1, theW1, theL1, theR2, theW2, theL2, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2)
if (theP1 and theP2 and theP3):
anObj = self.AdvOp.MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh, theP1, theP2, theP3)
else:
anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
RaiseIfFailed("MakePipeTShape", self.AdvOp)
if Parameters: anObj[0].SetParameters(Parameters)
return anObj
## Create a T-shape object with specified caracteristics for the main
# and the incident pipes (radius, width, half-length). A chamfer is
# created on the junction of the pipes.
# Center of the shape is (0,0,0). The main plane of the T-shape is
# XOY.
# @param theR1 Internal radius of main pipe
# @param theW1 Width of main pipe
# @param theL1 Half-length of main pipe
# @param theR2 Internal radius of incident pipe (R2 < R1)
# @param theW2 Width of incident pipe (R2+W2 < R1+W1)
# @param theL2 Half-length of incident pipe
# @param theH Height of the chamfer.
# @param theW Width of the chamfer.
# @param theHexMesh false = no partition, true = with partition (default=true)
# @param theP1 1st junction point of main pipe
# @param theP2 2nd junction point of main pipe
# @param theP3 Junction point of incident pipe
# @return List of GEOM_Objects, containing the created shape and propagation groups.
#
# @ref tui_creation_tshape "Example"
def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW)
if (theP1 and theP2 and theP3):
anObj = self.AdvOp.MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh, theP1, theP2, theP3)
else:
anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
if Parameters: anObj[0].SetParameters(Parameters)
return anObj
## Create a T-shape object with specified caracteristics for the main
# and the incident pipes (radius, width, half-length). A fillet is
# created on the junction of the pipes.
# Center of the shape is (0,0,0). The main plane of the T-shape is
# XOY.
# @param theR1 Internal radius of main pipe
# @param theW1 Width of main pipe
# @param theL1 Half-length of main pipe
# @param theR2 Internal radius of incident pipe (R2 < R1)
# @param theW2 Width of incident pipe (R2+W2 < R1+W1)
# @param theL2 Half-length of incident pipe
# @param theRF Radius of curvature of fillet.
# @param theHexMesh false = no partition, true = with partition (default=true)
# @param theP1 1st junction point of main pipe
# @param theP2 2nd junction point of main pipe
# @param theP3 Junction point of incident pipe
# @return List of GEOM_Objects, containing the created shape and propagation groups.
#
# @ref tui_creation_tshape "Example"
def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
theR1, theW1, theL1, theR2, theW2, theL2, theRF, Parameters = ParseParameters(theR1, theW1, theL1, theR2, theW2, theL2, theRF)
if (theP1 and theP2 and theP3):
anObj = self.AdvOp.MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh, theP1, theP2, theP3)
else:
anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
if Parameters: anObj[0].SetParameters(Parameters)
return anObj
#@@ insert new functions before this line @@#
# end of l4_advanced