+ if (SMESHGUI::isStudyLocked())
+ return false;
+
+ if( !isValid() )
+ return false;
+
+ if (myNbOkElements && IsAxisOk()) {
+ QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+
+ SMESH::long_array_var anElementsId = new SMESH::long_array;
+
+ anElementsId->length(aListElementsId.count());
+ for (int i = 0; i < aListElementsId.count(); i++)
+ anElementsId[i] = aListElementsId[i].toInt();
+
+ SMESH::AxisStruct anAxis;
+
+ anAxis.x = SpinBox_X->GetValue();
+ anAxis.y = SpinBox_Y->GetValue();
+ anAxis.z = SpinBox_Z->GetValue();;
+ anAxis.vx = SpinBox_DX->GetValue();
+ anAxis.vy = SpinBox_DY->GetValue();
+ anAxis.vz = SpinBox_DZ->GetValue();
+
+ double anAngle = (SpinBox_Angle->GetValue())*M_PI/180.;
+
+ QStringList aParameters;
+ aParameters << SpinBox_X->text();
+ aParameters << SpinBox_Y->text();
+ aParameters << SpinBox_Z->text();
+ aParameters << SpinBox_DX->text();
+ aParameters << SpinBox_DY->text();
+ aParameters << SpinBox_DZ->text();
+ aParameters << SpinBox_Angle->text();
+
+ int actionButton = ActionGroup->checkedId();
+ bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+ QStringList anEntryList;
+ try {
+ SUIT_OverrideCursor aWaitCursor;
+
+ switch ( actionButton ) {
+ case MOVE_ELEMS_BUTTON:
+ if(CheckBoxMesh->isChecked()) {
+ for ( int i = 0; i < myObjects.count(); i++ ) {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+ myMeshes[i]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ aMeshEditor->RotateObject(myObjects[i], anAxis, anAngle, false);
+ }
+ }
+ else {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+ myMeshes[0]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ aMeshEditor->Rotate(anElementsId, anAxis, anAngle, false);
+ }
+ break;
+ case COPY_ELEMS_BUTTON:
+ if ( makeGroups ) {
+ SMESH::ListOfGroups_var groups;
+ if(CheckBoxMesh->isChecked()) {
+ for ( int i = 0; i < myObjects.count(); i++ ) {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+ myMeshes[i]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ groups = aMeshEditor->RotateObjectMakeGroups(myObjects[i], anAxis, anAngle);
+ }
+ }
+ else {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+ myMeshes[0]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ groups = aMeshEditor->RotateMakeGroups(anElementsId, anAxis, anAngle);
+ }
+ }
+ else {
+ if(CheckBoxMesh->isChecked()) {
+ for ( int i = 0; i < myObjects.count(); i++ ) {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+ myMeshes[i]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ aMeshEditor->RotateObject(myObjects[i], anAxis, anAngle, true);
+ }
+ }
+ else {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+ myMeshes[0]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ aMeshEditor->Rotate(anElementsId, anAxis, anAngle, true);
+ }
+ }
+ break;
+ case MAKE_MESH_BUTTON: {
+ SMESH::SMESH_Mesh_var mesh;
+ if (CheckBoxMesh->isChecked()) {
+ for ( int i = 0; i < myObjects.count(); i++ ) {
+ QString aName = SMESH::UniqueMeshName( LineEditNewMesh->text().replace( "*", myObjectsNames[i] ) );
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
+ myMeshes[i]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ mesh = aMeshEditor->RotateObjectMakeMesh(myObjects[i], anAxis, anAngle, makeGroups,
+ aName.toUtf8().data());
+ if (!mesh->_is_nil()) {
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+ anEntryList.append( aSObject->GetID().c_str() );
+ }
+ }
+ }
+ else {
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
+ myMeshes[0]->SetParameters(aParameters.join( ":" ).toUtf8().constData());
+ mesh = aMeshEditor->RotateMakeMesh(anElementsId, anAxis, anAngle, makeGroups,
+ LineEditNewMesh->text().toUtf8().data());
+ if (!mesh->_is_nil()) {
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+ anEntryList.append( aSObject->GetID().c_str() );
+ }
+ }
+ break;
+ }
+ }
+ } catch (...) {
+ }
+
+ for ( int i = 0; i < myObjects.count(); i++ ) {
+ SMESH_Actor* actor = SMESH::FindActorByObject( myObjects[i] );
+ if ( actor ) SMESH::Update( actor->getIO(), true );
+ }
+
+ if ( ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ) ||
+ actionButton == MAKE_MESH_BUTTON ) {
+ mySMESHGUI->updateObjBrowser(true); // new groups may appear
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+ }
+ Init(false);
+
+ SMESHGUI::Modified();
+ }
+
+ return true;