From 87e982be73a2ff127090a41ee232e3203d4a2ffe Mon Sep 17 00:00:00 2001 From: dmv Date: Fri, 12 Feb 2010 07:17:19 +0000 Subject: [PATCH] 0020632: EDF 1173 GEOM : Extrusion with multiple selection --- .../gui/GEOM/input/creating_extrusion.doc | 9 +- .../input/creating_extrusion_alongpath.doc | 3 +- .../gui/GEOM/input/creating_revolution.doc | 3 +- src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 182 +++++++++--------- src/GenerationGUI/GenerationGUI_PipeDlg.h | 2 +- src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 175 +++++++---------- src/GenerationGUI/GenerationGUI_PrismDlg.h | 2 +- src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 78 ++++---- src/GenerationGUI/GenerationGUI_RevolDlg.h | 2 +- 9 files changed, 209 insertions(+), 247 deletions(-) diff --git a/doc/salome/gui/GEOM/input/creating_extrusion.doc b/doc/salome/gui/GEOM/input/creating_extrusion.doc index 6cc92388c..c86ed5ac5 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion.doc @@ -5,13 +5,14 @@ \n To generate an \b Extrusion on an object in the Main Menu select New Entity - > Generation - > Extrusion -\n There are 2 algorithms for creation of an \b Extrusion (Prism). +\n There are 3 algorithms for creation of an \b Extrusion (Prism). \n The \b Result of the operation will be a GEOM_Object (edge, face, shell solid or compsolid). \n Firstly, you can define the Base Shape (a basis of the extrusion), the \b Vector (a direction of the extrusion) and the \b -Height of extrusion. +Height of extrusion.
+It is possible to select in GUI several Base Shapes to make several extrusions (using Shift button). \n The \b Result of the operation will be a GEOM_Object (edge, face, shell, solid or compsolid). \n Both Directions checkbox allows extruiding the source @@ -23,7 +24,7 @@ extrusion) + 1 value (dimension). \image html extrusion1.png -\n Secondly, you can define the \b Extrusion by the Base Shape +\n Secondly, you can define the \b Extrusion by the Base Shape(s) and the \b Start and End Point of the \b Vector (in this way you don't need to create it in advance). \n Both Directions checkbox allows extruiding the source @@ -34,7 +35,7 @@ shell) serving as base object + 2 vertices. \image html extrusion2.png -\n Finally, you can define the \b Extrusion by the Base Shape +\n Finally, you can define the \b Extrusion by the Base Shape(s) and the DX, DY, DZ Vector\n Both Directions checkbox allows extruding the source objects both forward and backward. diff --git a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc index 1178fd1e6..ddf89e09d 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc @@ -7,7 +7,8 @@ To generate a \b Pipe in the Main Menu select New Entity - > Generatio \n Firstly, to create an extruded \b Pipe shape, you can define the Base Object (vertex, edge, planar wire, face or shell), which will be extruded and the Path Object (edge or wire) along which the Base -Object will be extruded. +Object will be extruded.
+It is possible to select in GUI several Base Objects to make several pipes (using Shift button). \n In this mode the default pipe generation algorithm is used. The pipe is created so that the angle between the normal vector to the base shape and the tangent to the path wire remains constant at any point of the diff --git a/doc/salome/gui/GEOM/input/creating_revolution.doc b/doc/salome/gui/GEOM/input/creating_revolution.doc index 80c7ebc5f..692f7c63f 100644 --- a/doc/salome/gui/GEOM/input/creating_revolution.doc +++ b/doc/salome/gui/GEOM/input/creating_revolution.doc @@ -7,7 +7,8 @@ select New Entity - > Generation - > Revolution \n To create an extruded shape by \b Revolution you need to define the source \b Object to rotate, the \b Axis of revolution and the \b Angle by which -the \b Shape has to be rotated around the \b Axis (in degrees). +the \b Shape has to be rotated around the \b Axis (in degrees).
+It is possible to select in GUI several objects to make several revolutions (using Shift button). \n Both Directions checkbox allows extruding the source object both forward and backward. \n The \b Result of the operation will be a GEOM_Object (edge, face, shell, diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index fc12dfb7c..2f596dafa 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -113,7 +113,7 @@ void GenerationGUI_PipeDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit3->setText(""); - myBase = myPath = myVec = GEOM::GEOM_Object::_nil(); + myPath = myVec = GEOM::GEOM_Object::_nil(); myOkBase = myOkPath = myOkVec = false; GroupPoints->CheckButton1->setEnabled(false); @@ -171,6 +171,9 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId ) break; } } + qApp->processEvents(); + updateGeometry(); + resize(100,100); displayPreview(); } @@ -240,12 +243,12 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - if (aSelList.Extent() != 1) + if (aSelList.Extent() < 1) return; - // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + QString aName = GEOMBase::GetName(aSelectedObject); if (!testResult || aSelectedObject->_is_nil()) return; @@ -255,98 +258,87 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() return; if (myEditCurrentArgument == GroupPoints->LineEdit1) { - if (S.ShapeType() == TopAbs_COMPSOLID || - S.ShapeType() == TopAbs_COMPOUND || - S.ShapeType() == TopAbs_SOLID || - S.ShapeType() == TopAbs_SHAPE) - return; - if ( getConstructorId() == 1 && - (S.ShapeType() == TopAbs_SHELL || - S.ShapeType() == TopAbs_VERTEX)) - return; - - myBase = aSelectedObject; - myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); + myOkBase = false; + GEOMBase::ConvertListOfIOInListOfGO(aSelList, myBaseObjects, true); + if (aSelList.Extent() > 1) + aName = QString( "%1_objects").arg( aSelList.Extent() ); + + if ( aSelList.Extent() > 0 ) { + // check base shapes + for (int i=0; i < myBaseObjects.length(); i++) { + GEOMBase::GetShape(myBaseObjects[i], S); + if (S.ShapeType() == TopAbs_COMPSOLID || + S.ShapeType() == TopAbs_COMPOUND || + S.ShapeType() == TopAbs_SOLID || + S.ShapeType() == TopAbs_SHAPE) + return; + if ( getConstructorId() == 1 && + (S.ShapeType() == TopAbs_SHELL || + S.ShapeType() == TopAbs_VERTEX)) + return; + } + } + + myEditCurrentArgument->setText(aName); myOkBase = true; - if (!myOkPath) - GroupPoints->PushButton2->click(); - else if (!myOkVec) - GroupPoints->PushButton3->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2 || + } else if (myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupPoints->LineEdit3) { myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false; bool myOk = false; - QString aName = GEOMBase::GetName(aSelectedObject); if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){ myPath = aSelectedObject; myOkPath = true; myEditCurrentArgument->setText(aName); - } - else - { - if (aSelectedObject != myBase) { - TColStd_IndexedMapOfInteger aMap; - aSelMgr->GetIndexes(aSelList.First(), aMap); - if (aMap.Extent() == 1) { - int anIndex = aMap(1); - aName.append(":edge_" + QString::number(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); - myOk = true; - } - else { // get Object from study - aSelectedObject = aFindedObject; - myOk = true; - } - } - else { - myOk = true; - if (S.ShapeType() != TopAbs_EDGE) { - aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; - myOk = false; - } - } - if (myEditCurrentArgument == GroupPoints->LineEdit2) { - myPath = aSelectedObject; - myOkPath = myOk; - } - else if (myEditCurrentArgument == GroupPoints->LineEdit3) { - myVec = aSelectedObject; - myOkVec = myOk; - } + } else { + TColStd_IndexedMapOfInteger aMap; + aSelMgr->GetIndexes(aSelList.First(), aMap); + if (aMap.Extent() == 1) { + int anIndex = aMap(1); + aName.append(":edge_" + QString::number(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); + myOk = true; + } else { // get Object from study + aSelectedObject = aFindedObject; + myOk = true; } - myEditCurrentArgument->setText(aName); - - if (myOkPath) { - if (!myOkBase) - GroupPoints->PushButton1->click(); - else if (!myOkVec) - GroupPoints->PushButton3->click(); - } - else if (myOkVec) { - if (!myOkBase) - GroupPoints->PushButton1->click(); - else if (!myOkPath) - GroupPoints->PushButton2->click(); + } else { + myOk = true; + if (S.ShapeType() != TopAbs_EDGE) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + myOk = false; } } + if (myEditCurrentArgument == GroupPoints->LineEdit2) { + myPath = aSelectedObject; + myOkPath = myOk; + } else if (myEditCurrentArgument == GroupPoints->LineEdit3) { + myVec = aSelectedObject; + myOkVec = myOk; + } + myEditCurrentArgument->setText(aName); + + if (myOkPath) { + if (!myOkBase) + GroupPoints->PushButton1->click(); + else if (!myOkVec) + GroupPoints->PushButton3->click(); + } else if (myOkVec) { + if (!myOkBase) + GroupPoints->PushButton1->click(); + else if (!myOkPath) + GroupPoints->PushButton2->click(); + } + } } - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - displayPreview(); } @@ -473,22 +465,24 @@ bool GenerationGUI_PipeDlg::isValid (QString&) //================================================================================= bool GenerationGUI_PipeDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_Object_var anObj, aBase; GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); - switch ( getConstructorId() ) { - case 0 : - anObj = anOper->MakePipe(myBase, myPath); - break; - case 1 : - anObj = anOper->MakePipeBiNormalAlongVector(myBase, myPath, myVec); - break; + for (int i=0; i < myBaseObjects.length(); i++) { + aBase = myBaseObjects[i]; + switch ( getConstructorId() ) { + case 0 : + anObj = anOper->MakePipe(aBase, myPath); + break; + case 1 : + anObj = anOper->MakePipeBiNormalAlongVector(aBase, myPath, myVec); + break; + } + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); } - - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); - return true; } diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index ed0b92625..38249faec 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -54,7 +54,7 @@ private: void enterEvent( QEvent* ); private: - GEOM::GEOM_Object_var myBase; /* Base shape */ + GEOM::ListOfGO myBaseObjects; /* Base shapes */ GEOM::GEOM_Object_var myPath; /* Shape, defining the path */ GEOM::GEOM_Object_var myVec; /* Vector, defining the constant binormal direction */ bool myOkBase; diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index de01faa9e..bb609f2dd 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -169,7 +169,7 @@ void GenerationGUI_PrismDlg::Init() GroupPoints3->LineEdit1->setText(""); - myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); + myPoint1 = myPoint2 = myVec = GEOM::GEOM_Object::_nil(); myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; // signals and slots connections @@ -278,13 +278,8 @@ void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId) updateGeometry(); resize(minimumSizeHint()); - if (myInitial) { - myInitial = false; - SelectionIntoArgument(); - } - else { - displayPreview(); - } + SelectionIntoArgument(); + displayPreview(); } //================================================================================= @@ -325,17 +320,34 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); + QString aBaseName = ""; /* name of base object selection */ + int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aBaseName, true); + + if (nbSel > 1) + aBaseName = QString( "%1_objects").arg( nbSel ); + + // Base Object(s) selected + if (myEditCurrentArgument == GroupPoints->LineEdit1 || + myEditCurrentArgument == GroupPoints2->LineEdit1 || + getConstructorId() == 2 ) { + myOkBase = false; + if ( nbSel > 0 ) { + GEOMBase::ConvertListOfIOInListOfGO(aSelList, myBaseObjects, true); + myEditCurrentArgument->setText( aBaseName ); + myOkBase = true; + } + displayPreview(); + return; + } + if (getConstructorId() == 0) { - if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints->LineEdit1) - myOkBase = false; - else if (myEditCurrentArgument == GroupPoints->LineEdit2) + if (aSelList.Extent() < 1) { + if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkVec = false; return; } - // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); @@ -376,26 +388,15 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() } } - myEditCurrentArgument->setText(aName); - - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - myBase = aSelectedObject; - myOkBase = true; - if (!myOkVec) - GroupPoints->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) { + if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) { + myEditCurrentArgument->setText(aName); myOkVec = true; myVec = aSelectedObject; - if (!myOkBase) - GroupPoints->PushButton1->click(); } } else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points if (aSelList.Extent() != 1) { - if (myEditCurrentArgument == GroupPoints2->LineEdit1) - myOkBase = false; - else if (myEditCurrentArgument == GroupPoints2->LineEdit2) { + if (myEditCurrentArgument == GroupPoints2->LineEdit2) { myPoint1 = GEOM::GEOM_Object::_nil(); myOkPnt1 = false; } @@ -406,7 +407,6 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() return; } - // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); @@ -447,13 +447,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myEditCurrentArgument->setText(aName); - if (myEditCurrentArgument == GroupPoints2->LineEdit1) { - myOkBase = true; - myBase = aSelectedObject; - if (!myOkPnt1) - GroupPoints2->PushButton2->click(); - } - else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) { + if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) { myOkPnt1 = true; myPoint1 = aSelectedObject; if (!myOkPnt2) @@ -466,25 +460,6 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() GroupPoints2->PushButton1->click(); } } - else if (getConstructorId() == 2) { // extrusion using dx dy dz - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult || CORBA::is_nil(aSelectedObject)) - return; - - QString aName = GEOMBase::GetName(aSelectedObject); - myBase = aSelectedObject; - myOkBase = true; - myEditCurrentArgument->setText(aName); - } - - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); displayPreview(); } @@ -651,60 +626,54 @@ bool GenerationGUI_PrismDlg::isValid (QString& msg) bool GenerationGUI_PrismDlg::execute (ObjectList& objects) { QStringList aParameters; - GEOM::GEOM_Object_var anObj; + GEOM::GEOM_Object_var anObj, aBaseObj; GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); - switch (getConstructorId()) { - case 0: - if (!myBothway) { - anObj = anOper->MakePrismVecH(myBase, myVec, getHeight()); - } - else { - anObj = anOper->MakePrismVecH2Ways(myBase, myVec, getHeight()); - } - - if (!anObj->_is_nil() && !IsPreview()) - { - aParameters << GroupPoints->SpinBox_DX->text(); - anObj->SetParameters(aParameters.join(":").toLatin1().constData()); - } - - break; - case 1: - if (!myBothway2) { - anObj = anOper->MakePrismTwoPnt(myBase, myPoint1, myPoint2); - } - else { - anObj = anOper->MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2); - } - break; - case 2: - double dx = GroupPoints3->SpinBox_DX->value(); - double dy = GroupPoints3->SpinBox_DY->value(); - double dz = GroupPoints3->SpinBox_DZ->value(); - - if (!myBothway3) { - anObj = anOper->MakePrismDXDYDZ(myBase, dx, dy, dz); - } - else { - anObj = anOper->MakePrismDXDYDZ2Ways(myBase, dx, dy, dz); - } - - if (!anObj->_is_nil() && !IsPreview()) - { - aParameters << GroupPoints3->SpinBox_DX->text(); - aParameters << GroupPoints3->SpinBox_DY->text(); - aParameters << GroupPoints3->SpinBox_DZ->text(); - anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + for (int i=0; i < myBaseObjects.length(); i++) { + aBaseObj = myBaseObjects[i]; + + switch (getConstructorId()) { + case 0: + if (!myBothway) + anObj = anOper->MakePrismVecH(aBaseObj, myVec, getHeight()); + else + anObj = anOper->MakePrismVecH2Ways(aBaseObj, myVec, getHeight()); + + if (!anObj->_is_nil() && !IsPreview()) { + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + break; + case 1: + if (!myBothway2) + anObj = anOper->MakePrismTwoPnt(aBaseObj, myPoint1, myPoint2); + else + anObj = anOper->MakePrismTwoPnt2Ways(aBaseObj, myPoint1, myPoint2); + break; + case 2: + double dx = GroupPoints3->SpinBox_DX->value(); + double dy = GroupPoints3->SpinBox_DY->value(); + double dz = GroupPoints3->SpinBox_DZ->value(); + + if (!myBothway3) + anObj = anOper->MakePrismDXDYDZ(aBaseObj, dx, dy, dz); + else + anObj = anOper->MakePrismDXDYDZ2Ways(aBaseObj, dx, dy, dz); + + if (!anObj->_is_nil() && !IsPreview()) { + aParameters << GroupPoints3->SpinBox_DX->text(); + aParameters << GroupPoints3->SpinBox_DY->text(); + aParameters << GroupPoints3->SpinBox_DZ->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + break; } - - break; + + if (!anObj->_is_nil()) + objects.push_back(anObj._retn()); } - - if (!anObj->_is_nil()) - objects.push_back(anObj._retn()); - + return true; } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index 1ccc7461b..cfa1b5412 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -57,7 +57,7 @@ private: double getHeight() const; private: - GEOM::GEOM_Object_var myBase; /* Base shape */ + GEOM::ListOfGO myBaseObjects; /* Base shapes */ GEOM::GEOM_Object_var myVec; /* Vector, defining the direction */ GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index b5f35c767..1a3f3d34d 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -71,7 +71,7 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg (GeometryGUI* theGeometryGUI, QWi GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget()); GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); GroupPoints->TextLabel2->setText(tr("GEOM_AXIS")); GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); GroupPoints->PushButton1->setIcon(image1); @@ -118,7 +118,7 @@ void GenerationGUI_RevolDlg::Init() GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit2->setText(""); - myBase = myAxis = GEOM::GEOM_Object::_nil(); + myAxis = GEOM::GEOM_Object::_nil(); myOkBase = myOkAxis = false; // signals and slots connections @@ -219,12 +219,12 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() SALOME_ListIO aSelList; aSelMgr->selectedObjects(aSelList); - if (aSelList.Extent() != 1) + if (aSelList.Extent() < 1) return; - // nbSel == 1 Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + QString aName = GEOMBase::GetName(aSelectedObject); if (!testResult || aSelectedObject->_is_nil()) return; @@ -233,17 +233,22 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() if (!GEOMBase::GetShape(aSelectedObject, S) || S.IsNull()) return; - QString aName = GEOMBase::GetName(aSelectedObject); - if (myEditCurrentArgument == GroupPoints->LineEdit1) { - if (!isAcceptableBase(S)) - return; - - myBase = aSelectedObject; - myOkBase = true; - myEditCurrentArgument->setText(aName); - if (!myOkAxis) - GroupPoints->PushButton2->click(); + myOkBase = false; + if (aSelList.Extent() > 1) + aName = QString( "%1_objects").arg( aSelList.Extent() ); + + if ( aSelList.Extent() > 0 ) { + GEOMBase::ConvertListOfIOInListOfGO(aSelList, myBaseObjects, true); + // check base shapes + for (int i=0; i < myBaseObjects.length(); i++) { + GEOMBase::GetShape(myBaseObjects[i], S); + if (!isAcceptableBase(S)) + return; + } + myEditCurrentArgument->setText( aName ); + myOkBase = true; + } } else if (myEditCurrentArgument == GroupPoints->LineEdit2) { TColStd_IndexedMapOfInteger aMap; @@ -260,13 +265,11 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() getGeomEngine()->GetIShapesOperations(getStudyId()); myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); myOkAxis = true; - } - else { + } else { myAxis = aFindedObject; myOkAxis = true; } - } - else { + } else { myOkAxis = true; if (S.ShapeType() != TopAbs_EDGE) { aSelectedObject = GEOM::GEOM_Object::_nil(); @@ -280,12 +283,6 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() GroupPoints->PushButton1->click(); } - // clear selection - disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); - myGeomGUI->getApp()->selectionMgr()->clearSelected(); - connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), - this, SLOT(SelectionIntoArgument())); - displayPreview(); } @@ -403,26 +400,25 @@ bool GenerationGUI_RevolDlg::isValid (QString& msg) //================================================================================= bool GenerationGUI_RevolDlg::execute (ObjectList& objects) { - GEOM::GEOM_Object_var anObj; - + GEOM::GEOM_Object_var anObj, aBase; GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); - if (!myBothway) { - anObj = anOper->MakeRevolutionAxisAngle(myBase, myAxis, getAngle() * PI180); - } - else { - anObj = anOper->MakeRevolutionAxisAngle2Ways(myBase, myAxis, getAngle() * PI180); - } - - if (!anObj->_is_nil()) - { - if (!IsPreview()) - { - QStringList aParameters; - aParameters << GroupPoints->SpinBox_DX->text(); - anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + for (int i=0; i < myBaseObjects.length(); i++) { + aBase = myBaseObjects[i]; + + if (!myBothway) + anObj = anOper->MakeRevolutionAxisAngle(aBase, myAxis, getAngle() * PI180); + else + anObj = anOper->MakeRevolutionAxisAngle2Ways(aBase, myAxis, getAngle() * PI180); + + if (!anObj->_is_nil()) { + if (!IsPreview()) { + QStringList aParameters; + aParameters << GroupPoints->SpinBox_DX->text(); + anObj->SetParameters(aParameters.join(":").toLatin1().constData()); + } + objects.push_back(anObj._retn()); } - objects.push_back(anObj._retn()); } return true; diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h index 89318effc..f4bc70631 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.h +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -55,7 +55,7 @@ private: double getAngle() const; private: - GEOM::GEOM_Object_var myBase; /* Base shape */ + GEOM::ListOfGO myBaseObjects; /* Base shapes */ GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */ bool myOkBase; bool myOkAxis; -- 2.39.2