From d4675122f5ede78f9c338c7b5d0e1f8380fc3c05 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 7 Mar 2012 15:13:29 +0000 Subject: [PATCH] 0021308: Remove hard-coded dependency of the external mesh plugins from the SMESH module Now it's necessary to call myMesh->SetParameters() just before calling a method using parameters that can be defined via notebook variables --- src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx | 8 +-- .../SMESHGUI_ExtrusionAlongPathDlg.cxx | 54 ++----------------- src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx | 21 ++++---- src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 14 ++++- src/SMESHGUI/SMESHGUI_Hypotheses.h | 3 ++ src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx | 12 ++--- src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx | 13 ++--- src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx | 10 ++-- src/SMESHGUI/SMESHGUI_NodesDlg.cxx | 2 +- src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx | 3 +- src/SMESHGUI/SMESHGUI_RotationDlg.cxx | 8 ++- src/SMESHGUI/SMESHGUI_ScaleDlg.cxx | 8 ++- src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx | 4 +- src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx | 9 +--- src/SMESHGUI/SMESHGUI_TranslationDlg.cxx | 30 +++++------ 15 files changed, 78 insertions(+), 121 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx index 85ea6b33e..0d97f601d 100644 --- a/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_BuildCompoundDlg.cxx @@ -295,13 +295,17 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() SMESH::SMESH_Mesh_var aCompoundMesh; - if (!myMesh->_is_nil()) { + if (!myMesh->_is_nil()) + { QStringList aParameters; aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" ")); + QStringList anEntryList; try { SUIT_OverrideCursor aWaitCursor; + myMeshArray[0]->SetParameters( aParameters.join(":").toLatin1().constData() ); + SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen(); // concatenate meshes if(CheckBoxCommon->isChecked()) @@ -315,8 +319,6 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply() CheckBoxMerge->isChecked(), SpinBoxTol->GetValue()); - aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); - _PTR(SObject) aSO = SMESH::FindSObject( aCompoundMesh ); if( aSO ) { SMESH::SetName( aSO, LineEditName->text() ); diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index 640b22d38..a72452292 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -533,55 +533,11 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() try { SUIT_OverrideCursor wc; - SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); - //if ( LinearAnglesCheck->isChecked() ) { - // anAngles = aMeshEditor->LinearAnglesVariation( myPathMesh, myPathShape, anAngles ); - //} + SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); SMESH::SMESH_MeshEditor::Extrusion_Error retVal; - /* - if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) { - if( MeshCheck->isChecked() ) { - if( GetConstructorId() == 0 ) - SMESH::ListOfGroups_var groups = - aMeshEditor->ExtrusionAlongPathObject1DMakeGroups(myIDSource, myPathMesh, - myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles, - BasePointGrp->isChecked(), aBasePoint, retVal); - else - SMESH::ListOfGroups_var groups = - aMeshEditor->ExtrusionAlongPathObject2DMakeGroups(myIDSource, myPathMesh, - myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles, - BasePointGrp->isChecked(), aBasePoint, retVal); - } - else - SMESH::ListOfGroups_var groups = - aMeshEditor->ExtrusionAlongPathMakeGroups(anElementsId, myPathMesh, - myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles, - BasePointGrp->isChecked(), aBasePoint, retVal); - } - else { - if( MeshCheck->isChecked() ) { - if( GetConstructorId() == 0 ) - retVal = aMeshEditor->ExtrusionAlongPathObject1D(myIDSource, myPathMesh, - myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles, - BasePointGrp->isChecked(), aBasePoint); - else - retVal = aMeshEditor->ExtrusionAlongPathObject2D(myIDSource, myPathMesh, - myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles, - BasePointGrp->isChecked(), aBasePoint); - } - else - retVal = aMeshEditor->ExtrusionAlongPath(anElementsId, myPathMesh, - myPathShape, aNodeStart, - AnglesGrp->isChecked(), anAngles, - BasePointGrp->isChecked(), aBasePoint); - } - */ + + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); bool NeedGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ); SMESH::ElementType ElemType = SMESH::FACE; @@ -603,10 +559,6 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() } - if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); - - //wc.stop(); wc.suspend(); switch (retVal) { case SMESH::SMESH_MeshEditor::EXTR_NO_ELEMENTS: diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx index ab65f0570..482d5c8d6 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionDlg.cxx @@ -552,10 +552,11 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() aParameters << SpinBox_Dy->text(); aParameters << SpinBox_Dz->text(); } else if ( RadioButton4->isChecked() ) { - aParameters << SpinBox_Vx->text(); - aParameters << SpinBox_Vy->text(); - aParameters << SpinBox_Vz->text(); - aParameters << SpinBox_VDist->text(); + // only 3 coords in a python dump command :( + // aParameters << SpinBox_Vx->text(); + // aParameters << SpinBox_Vy->text(); + // aParameters << SpinBox_Vz->text(); + // aParameters << SpinBox_VDist->text(); } long aNbSteps = (long)SpinBox_NbSteps->value(); @@ -566,6 +567,8 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) { if( CheckBoxMesh->isChecked() ) switch (GetConstructorId() ) { @@ -624,8 +627,6 @@ bool SMESHGUI_ExtrusionDlg::ClickOnApply() aMeshEditor->ExtrusionSweep(myElementsId.inout(), aVector, aNbSteps); } - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); - } catch (...) { } @@ -724,7 +725,7 @@ void SMESHGUI_ExtrusionDlg::onTextChange (const QString& theNewText) { SMESHType = SMESH::EDGE; SMDSType = SMDSAbs_Edge; - break; + break; } case 2: { @@ -1187,17 +1188,17 @@ void SMESHGUI_ExtrusionDlg::onDisplaySimulation( bool toDisplayPreview ) { case 0: { aMeshEditor->ExtrusionSweepObject0D(mySelectedObject, aVector, aNbSteps); - break; + break; } case 1: { aMeshEditor->ExtrusionSweepObject1D(mySelectedObject, aVector, aNbSteps); - break; + break; } case 2: { aMeshEditor->ExtrusionSweepObject2D(mySelectedObject, aVector, aNbSteps); - break; + break; } } } diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index 4c3438dc7..f94f39785 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -332,18 +332,20 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par { SalomeApp_IntSpinBox* sb = ( SalomeApp_IntSpinBox* )( *anIt ); item.myValue = sb->value(); + item.myText = sb->text(); params.append( item ); } else if( (*anIt)->inherits( "SalomeApp_DoubleSpinBox" ) ) { SalomeApp_DoubleSpinBox* sb = ( SalomeApp_DoubleSpinBox* )( *anIt ); item.myValue = sb->value(); + item.myText = sb->text(); params.append( item ); } else if( (*anIt)->inherits( "QLineEdit" ) ) { QLineEdit* line = ( QLineEdit* )( *anIt ); - item.myValue = line->text(); + item.myValue = item.myText = line->text(); params.append( item ); } else if ( getParamFromCustomWidget( item, *anIt )) @@ -356,6 +358,16 @@ bool SMESHGUI_GenericHypothesisCreator::getStdParamFromDlg( ListOfStdParams& par return res; } +QString SMESHGUI_GenericHypothesisCreator::getVariableName(const char* methodName) const +{ + SMESH::SMESH_Hypothesis_var h = hypothesis(); + if ( !h->_is_nil() ) + { + CORBA::String_var aVaribaleName = h->GetVarParameter( methodName ); + return QString( aVaribaleName.in() ); + } + return QString(); +} QStringList SMESHGUI_GenericHypothesisCreator::getVariablesFromDlg() const { diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index b0edacf3d..d2cd29564 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -81,9 +81,11 @@ protected: QString myName; QVariant myValue; bool isVariable; + QString myText; StdParam(){ isVariable = false; } + const char* text() const { return myText.toLatin1().constData(); } }; typedef QList ListOfStdParams; @@ -95,6 +97,7 @@ protected: const ListOfWidgets& widgets() const; ListOfWidgets& changeWidgets(); QtxDialog* dlg() const; + QString getVariableName(const char* methodName) const; virtual QFrame* buildFrame() = 0; QFrame* buildStdFrame(); diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index 0793da3c0..dcdb0e52c 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -429,6 +429,10 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() return false; } + QStringList aParameters; + aParameters << myDlg->myX->text(); + aParameters << myDlg->myY->text(); + aParameters << myDlg->myZ->text(); try { SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(myMeshActor->getIO()); @@ -441,6 +445,8 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() if (aMeshEditor->_is_nil()) return true; + aMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + bool ok; int anId = myDlg->myId->text().toInt( &ok ); if( !ok || anId < 1 ) @@ -455,12 +461,6 @@ bool SMESHGUI_MakeNodeAtPointOp::onApply() if (aResult) { - QStringList aParameters; - aParameters << myDlg->myX->text(); - aParameters << myDlg->myY->text(); - aParameters << myDlg->myZ->text(); - aMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); - myDlg->myCurrentX->SetValue(0); myDlg->myCurrentY->SetValue(0); myDlg->myCurrentZ->SetValue(0); diff --git a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx index dac90473a..91632bbfd 100755 --- a/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshPatternDlg.cxx @@ -468,6 +468,13 @@ bool SMESHGUI_MeshPatternDlg::onApply() erasePreview(); if (isRefine()) { // Refining existing mesh elements + { + QStringList aParameters; + aParameters << myNode1->text(); + if(myType == Type_3d ) + aParameters << myNode2->text(); + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + } QList ids; getIds(ids); SMESH::long_array_var varIds = new SMESH::long_array(); @@ -479,12 +486,6 @@ 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( aParameters.join(":").toLatin1().constData() ); - } else { // Applying a pattern to geometrical object if (myType == Type_2d) myPattern->ApplyToFace(myGeomObj[Object], myGeomObj[Vertex1], myReverseChk->isChecked()); diff --git a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx index ae9d178a3..aa26a3494 100755 --- a/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx @@ -1205,6 +1205,11 @@ bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito const SMESH::long_array& theIds, SMESH::SMESH_IDSource_ptr obj) { + { + QStringList aParameters; + aParameters << myMaxAngleSpin->text(); + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + } SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor(); double aMaxAngle = myMaxAngleSpin->GetValue() * M_PI / 180.0; bool ok; @@ -1212,11 +1217,6 @@ bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito ok = theEditor->TriToQuad(theIds, aCriterion, aMaxAngle); else ok = theEditor->TriToQuadObject(obj, aCriterion, aMaxAngle); - if( ok ) { - QStringList aParameters; - aParameters << myMaxAngleSpin->text(); - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); - } return ok; } diff --git a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx index 286d0012e..c8cec8efc 100644 --- a/src/SMESHGUI/SMESHGUI_NodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_NodesDlg.cxx @@ -100,8 +100,8 @@ namespace SMESH try { _PTR(SObject) aSobj = SMESH::FindSObject( theMesh ); SMESH::SMESH_MeshEditor_var aMeshEditor = theMesh->GetMeshEditor(); - aNodeId = aMeshEditor->AddNode( x, y, z ); theMesh->SetParameters( theParameters.join(":").toLatin1().constData() ); + aNodeId = aMeshEditor->AddNode( x, y, z ); _PTR(Study) aStudy = GetActiveStudyDocument(); CORBA::Long anId = aStudy->StudyId(); if (TVisualObjPtr aVisualObj = SMESH::GetVisualObj( anId, aSobj->GetID().c_str() ) ) { diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 65eb1ed28..7fddebc36 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -519,6 +519,8 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply() SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) { if( CheckBoxMesh->isChecked() ) { if( GetConstructorId() == 0 ) @@ -546,7 +548,6 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply() aMeshEditor->RotationSweep(anElementsId.inout(), anAxis, anAngle, aNbSteps, aTolerance); } - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); } catch (...) { } diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index f11fd3b78..a4a4f87f2 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -433,14 +433,15 @@ bool SMESHGUI_RotationDlg::ClickOnApply() try { SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + + myMesh->SetParameters(aParameters.join(":").toLatin1().constData()); + switch ( actionButton ) { case MOVE_ELEMS_BUTTON: if(CheckBoxMesh->isChecked()) aMeshEditor->RotateObject(mySelectedObject, anAxis, anAngle, false); else aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false); - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; case COPY_ELEMS_BUTTON: if ( makeGroups ) { @@ -456,8 +457,6 @@ bool SMESHGUI_RotationDlg::ClickOnApply() else aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true); } - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; case MAKE_MESH_BUTTON: { SMESH::SMESH_Mesh_var mesh; @@ -468,7 +467,6 @@ bool SMESHGUI_RotationDlg::ClickOnApply() mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups, LineEditNewMesh->text().toLatin1().data()); if (!mesh->_is_nil()) { - mesh->SetParameters(aParameters.join(":").toLatin1().constData()); if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) anEntryList.append( aSObject->GetID().c_str() ); #ifdef WITHGENERICOBJ diff --git a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx index b42821862..1fa454e71 100644 --- a/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ScaleDlg.cxx @@ -475,6 +475,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply() try { SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + SMESH::SMESH_IDSource_var obj; if ( CheckBoxMesh->isChecked() ) obj = mySelectedObject; @@ -485,8 +488,6 @@ bool SMESHGUI_ScaleDlg::ClickOnApply() case MOVE_ELEMS_BUTTON: aMeshEditor->Scale(obj, aPoint, aScaleFact, false); - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; case COPY_ELEMS_BUTTON: @@ -495,8 +496,6 @@ bool SMESHGUI_ScaleDlg::ClickOnApply() aMeshEditor->ScaleMakeGroups(obj, aPoint, aScaleFact); else aMeshEditor->Scale(obj, aPoint, aScaleFact, true); - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; case MAKE_MESH_BUTTON: { @@ -504,7 +503,6 @@ bool SMESHGUI_ScaleDlg::ClickOnApply() aMeshEditor->ScaleMakeMesh(obj, aPoint, aScaleFact, makeGroups, LineEditNewMesh->text().toLatin1().data()); if (!mesh->_is_nil()) { - mesh->SetParameters(aParameters.join(":").toLatin1().constData()); if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) anEntryList.append( aSObject->GetID().c_str() ); #ifdef WITHGENERICOBJ diff --git a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx index 055333cd2..161bb7125 100644 --- a/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SmoothingDlg.cxx @@ -380,6 +380,8 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply() SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); + if ( CheckBoxParametric->isChecked() ) { if(CheckBoxMesh->isChecked()) aResult = aMeshEditor->SmoothParametricObject(mySelectedObject, aNodesId.inout(), @@ -397,8 +399,6 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply() anIterationLimit, aMaxAspectRatio, aMethod); } - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); - } catch (...) { } diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index f70eacab3..f3ec2df0d 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -498,6 +498,8 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply() SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + myMesh->SetParameters(aParameters.join(":").toLatin1().constData()); + switch ( actionButton ) { case MOVE_ELEMS_BUTTON: { if(CheckBoxMesh->isChecked()) @@ -505,8 +507,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply() else aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, false ); - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; } case COPY_ELEMS_BUTTON: { @@ -523,8 +523,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply() else aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, true); } - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; } case MAKE_MESH_BUTTON: { @@ -535,8 +533,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply() else mesh = aMeshEditor->MirrorMakeMesh(anElementsId, aMirror, aMirrorType, makeGroups, LineEditNewMesh->text().toLatin1().data()); - if (!mesh->_is_nil()) { - mesh->SetParameters(aParameters.join(":").toLatin1().constData()); if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) anEntryList.append( aSObject->GetID().c_str() ); #ifdef WITHGENERICOBJ @@ -548,7 +544,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply() } break; } - } } catch (...) { } diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 5558ff579..efc2a0a23 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -480,41 +480,39 @@ bool SMESHGUI_TranslationDlg::ClickOnApply() anElementsId[i] = aListElementsId[i].toInt(); SMESH::DirStruct aVector; + QStringList aParameters; if (GetConstructorId() == 0) { aVector.PS.x = SpinBox2_1->GetValue() - SpinBox1_1->GetValue(); aVector.PS.y = SpinBox2_2->GetValue() - SpinBox1_2->GetValue(); aVector.PS.z = SpinBox2_3->GetValue() - SpinBox1_3->GetValue(); + // not supported so far + // aParameters << QString("%1 - %2").arg( SpinBox2_1->text() ).arg( SpinBox1_1->text() ); + // aParameters << QString("%1 - %2").arg( SpinBox2_2->text() ).arg( SpinBox1_2->text() ); + // aParameters << QString("%1 - %2").arg( SpinBox2_3->text() ).arg( SpinBox1_3->text() ); } else if (GetConstructorId() == 1) { aVector.PS.x = SpinBox1_1->GetValue(); aVector.PS.y = SpinBox1_2->GetValue(); aVector.PS.z = SpinBox1_3->GetValue(); + aParameters << SpinBox1_1->text(); + aParameters << SpinBox1_2->text(); + aParameters << SpinBox1_3->text(); } - QStringList aParameters; - aParameters << SpinBox1_1->text(); - if (GetConstructorId() == 0) - aParameters << SpinBox2_1->text(); - aParameters << SpinBox1_2->text(); - if (GetConstructorId() == 0) - aParameters << SpinBox2_2->text(); - aParameters << SpinBox1_3->text(); - if (GetConstructorId() == 0) - aParameters << SpinBox2_3->text(); - int actionButton = ActionGroup->checkedId(); bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ); QStringList anEntryList; try { SUIT_OverrideCursor aWaitCursor; SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); + + myMesh->SetParameters(aParameters.join(":").toLatin1().constData()); + switch ( actionButton ) { case MOVE_ELEMS_BUTTON: if(CheckBoxMesh->isChecked()) aMeshEditor->TranslateObject(mySelectedObject, aVector, false); else aMeshEditor->Translate(anElementsId, aVector, false); - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; case COPY_ELEMS_BUTTON: if ( makeGroups ) { @@ -530,10 +528,8 @@ bool SMESHGUI_TranslationDlg::ClickOnApply() else aMeshEditor->Translate(anElementsId, aVector, true); } - if( !myMesh->_is_nil()) - myMesh->SetParameters( aParameters.join(":").toLatin1().constData() ); break; - case MAKE_MESH_BUTTON: + case MAKE_MESH_BUTTON: { SMESH::SMESH_Mesh_var mesh; if (CheckBoxMesh->isChecked()) mesh = aMeshEditor->TranslateObjectMakeMesh(mySelectedObject, aVector, makeGroups, @@ -541,8 +537,6 @@ bool SMESHGUI_TranslationDlg::ClickOnApply() else mesh = aMeshEditor->TranslateMakeMesh(anElementsId, aVector, makeGroups, LineEditNewMesh->text().toLatin1().data()); - if (!mesh->_is_nil()) { - mesh->SetParameters(aParameters.join(":").toLatin1().constData()); if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) anEntryList.append( aSObject->GetID().c_str() ); #ifdef WITHGENERICOBJ -- 2.39.2