]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0020632: EDF 1173 GEOM : Extrusion with multiple selection
authordmv <dmv@opencascade.com>
Fri, 12 Feb 2010 07:17:19 +0000 (07:17 +0000)
committerdmv <dmv@opencascade.com>
Fri, 12 Feb 2010 07:17:19 +0000 (07:17 +0000)
doc/salome/gui/GEOM/input/creating_extrusion.doc
doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc
doc/salome/gui/GEOM/input/creating_revolution.doc
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.h
src/GenerationGUI/GenerationGUI_PrismDlg.cxx
src/GenerationGUI/GenerationGUI_PrismDlg.h
src/GenerationGUI/GenerationGUI_RevolDlg.cxx
src/GenerationGUI/GenerationGUI_RevolDlg.h

index 6cc92388cb0980d68a744fa1093005f65828d1d4..c86ed5ac537449aa4e2d78ca21a308bdae581cad 100644 (file)
@@ -5,13 +5,14 @@
 \n To generate an \b Extrusion on an object in the <b>Main Menu</b>
 select <b>New Entity - > Generation  - > Extrusion</b>
 
-\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 <b>Base Shape</b> (a basis of the
 extrusion), the \b Vector (a direction of the extrusion) and the \b
-Height of extrusion.
+Height of extrusion.<br>
+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 <b> Both Directions </b> 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 <b>Base Shape</b>
+\n Secondly, you can define the \b Extrusion by the <b>Base Shape(s)</b>
 and the \b Start and <b>End Point</b> of the \b Vector (in this way
 you don't need to create it in advance).
 \n <b> Both Directions </b> 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 <b>Base Shape</b>
+\n Finally, you can define the \b Extrusion by the <b>Base Shape(s)</b>
 and the <b>DX, DY, DZ</b> Vector\n
 <b>Both Directions</b> checkbox allows extruding the
 source objects both forward and backward.
index 1178fd1e6005206d9c790c5ef88157de1cc147a5..ddf89e09da604a7fbfdc2a84eb3b645fa68602ff 100644 (file)
@@ -7,7 +7,8 @@ To generate a \b Pipe in the <b>Main Menu</b> select <b>New Entity - > Generatio
 \n Firstly, to create an extruded \b Pipe shape, you can define the <b>Base
 Object</b> (vertex, edge, planar wire, face or shell), which will be extruded
 and the <b>Path Object</b> (edge or wire) along which the <b>Base 
-Object</b> will be extruded.
+Object</b> will be extruded.<br>
+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 <b>angle between the normal vector</b> to
 the base shape <b>and the tangent to the path</b> wire remains constant at any point of the
index 80c7ebc5fde6e0ba186514cc9656825fcf6f4fbd..692f7c63facb729cae06f5c6fd68eaee35969ef7 100644 (file)
@@ -7,7 +7,8 @@ select <b>New Entity - > Generation  - > Revolution</b>
 
 \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).<br>
+It is possible to select in GUI several objects to make several revolutions (using Shift button). 
 \n <b> Both Directions </b> 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,
index fc12dfb7ced82d484a1658a86c08847684f667c2..2f596dafa9102b7ab65d41508e555a05bf14c2bb 100644 (file)
@@ -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;
 }
 
index ed0b926257a60a76ee8b9a8099aedb552347e475..38249faec79585ba5823fa07dd784d680e888196 100644 (file)
@@ -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;
index de01faa9e97a0a6d11eb12d15ed104b3d96c01d9..bb609f2dd9951d9bc5e247244ccc82c620bfd4cc 100644 (file)
@@ -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;
 }
 
index 1ccc7461b2fba1342a235a826b07884d50a82d60..cfa1b541291e17b378a8f9af4a0dffdfe54ff4f5 100644 (file)
@@ -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 */ 
   
index b5f35c76799aaf9cb8678ecfca184f5ff1cf8bc9..1a3f3d34d19be348ac9c24fffabc4e05484e9a1e 100644 (file)
@@ -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;
index 89318effcd93df8f08c4204287439e72df4e2fff..f4bc70631980b383c6afa62ceeb79c0e33f01866 100644 (file)
@@ -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;