From: ouv Date: Fri, 5 Dec 2008 09:25:04 +0000 (+0000) Subject: Dump Puthon extension X-Git-Tag: TG_DumpPython_Extension_3_1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=60bd71d998707bc0973867106b9d2cc83b51edab;p=modules%2Fsmesh.git Dump Puthon extension --- diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index dff58aebe..81217d1a4 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include @@ -76,7 +77,6 @@ #include #include #include -#include #include #include #include @@ -246,9 +246,9 @@ QWidget* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent) mySelEdit[ Ids ] = new QLineEdit( myRefineGrp ); QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), myRefineGrp ); - myNode1 = new QSpinBox( myRefineGrp ); + myNode1 = new SalomeApp_IntSpinBox( myRefineGrp ); myNode2Lbl = new QLabel( tr( "NODE_2" ), myRefineGrp ); - myNode2 = new QSpinBox( myRefineGrp ); + myNode2 = new SalomeApp_IntSpinBox( myRefineGrp ); myRefineGrpLayout->addWidget( mySelLbl[ Ids ], 0, 0 ); myRefineGrpLayout->addWidget( mySelBtn[ Ids ], 0, 1 ); @@ -411,6 +411,24 @@ void SMESHGUI_MeshPatternDlg::Init() //======================================================================= bool SMESHGUI_MeshPatternDlg::isValid (const bool theMess) { + if (isRefine()) + { + QString msg; + bool ok = true; + ok = myNode1->isValid( msg, theMess ) && ok; + if (myType == Type_3d) + ok = myNode2->isValid( msg, theMess ) && ok; + if( !ok ) { + if( theMess ) { + QString str( tr( "SMESH_INCORRECT_INPUT" ) ); + if ( !msg.isEmpty() ) + str += "\n" + msg; + SUIT_MessageBox::critical( this, tr( "SMESH_ERROR" ), str ); + } + return false; + } + } + QList ids; if ((isRefine() && (myMesh->_is_nil() || !getIds(ids) || getNode(false) < 0 || @@ -460,6 +478,12 @@ bool SMESHGUI_MeshPatternDlg::onApply() ? myPattern->ApplyToMeshFaces (myMesh, varIds, getNode(false), myReverseChk->isChecked()) : myPattern->ApplyToHexahedrons(myMesh, varIds, getNode(false), getNode(true)); + QStringList aParameters; + aParameters << myNode1->text(); + if(myType == Type_3d ) + aParameters << myNode2->text(); + myMesh->SetParameters( SMESHGUI::JoinObjectParameters(aParameters) ); + } else { // Applying a pattern to geometrical object if (myType == Type_2d) myPattern->ApplyToFace(myGeomObj[Object], myGeomObj[Vertex1], myReverseChk->isChecked()); @@ -1375,8 +1399,8 @@ void SMESHGUI_MeshPatternDlg::onTextChanged (const QString& theNewText) void SMESHGUI_MeshPatternDlg::onNodeChanged (int value) { if (myType == Type_3d) { - QSpinBox* first = (QSpinBox*)sender(); - QSpinBox* second = first == myNode1 ? myNode2 : myNode1; + SalomeApp_IntSpinBox* first = (SalomeApp_IntSpinBox*)sender(); + SalomeApp_IntSpinBox* second = first == myNode1 ? myNode2 : myNode1; int secondVal = second->value(); if (secondVal == value) { secondVal = value == second->maximum() ? second->minimum() : value + 1; diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h index d74249b0e..e24fb32d0 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.h @@ -43,7 +43,7 @@ class QRadioButton; class QCheckBox; class QButtonGroup; class QLabel; -class QSpinBox; +class SalomeApp_IntSpinBox; class vtkUnstructuredGrid; class SALOME_Actor; class SVTK_Selector; @@ -129,8 +129,8 @@ private: QCheckBox* myRefine; QFrame* myRefineGrp; - QSpinBox* myNode1; - QSpinBox* myNode2; + SalomeApp_IntSpinBox* myNode1; + SalomeApp_IntSpinBox* myNode2; QLabel* myNode2Lbl; QFrame* myGeomGrp; diff --git a/src/SMESH_I/SMESH_NoteBook.cxx b/src/SMESH_I/SMESH_NoteBook.cxx index 91ae27def..e03cc0a9e 100644 --- a/src/SMESH_I/SMESH_NoteBook.cxx +++ b/src/SMESH_I/SMESH_NoteBook.cxx @@ -243,7 +243,15 @@ void SMESH_NoteBook::ReplaceVariables() } } + if(it == _objectMap.end()) { // additional check for pattern mapping + if(aMethod.IsEqual("ApplyToMeshFaces") || + aMethod.IsEqual("ApplyToHexahedrons")) + it = _objectMap.find(aCmd->GetArg(1)); + } + if(it != _objectMap.end()) { + if(MYDEBUG) + cout << "Found object : " << (*it).first << endl; ObjectStates *aStates = (*it).second; // Case for LocalLength hypothesis if(aStates->GetObjectType().IsEqual("LocalLength") && aStates->GetCurrectState().size() >= 2) { @@ -570,8 +578,20 @@ void SMESH_NoteBook::ReplaceVariables() } aStates->IncrementState(); } + else if(aMethod.IsEqual("ApplyToMeshFaces") || + aMethod.IsEqual("ApplyToHexahedrons")) { + int anArgIndex = aCmd->GetNbArgs()-1; + for(int j = 0; j < aCurrentStateSize; j++) + if(!aCurrentState.at(j).IsEmpty()) + aCmd->SetArg(anArgIndex+j, aCurrentState.at(j)); + aStates->IncrementState(); + } } } + else { + if(MYDEBUG) + cout << "Object not found" << endl; + } if(MYDEBUG) { cout<<"Command after: "<< aCmd->GetString()<