0020632: EDF 1173 GEOM : Extrusion with multiple selection

This commit is contained in:
dmv 2010-02-12 07:17:19 +00:00
parent 750c683d6f
commit 87e982be73
9 changed files with 205 additions and 243 deletions

View File

@ -5,13 +5,14 @@
\n To generate an \b Extrusion on an object in the <b>Main Menu</b> \n To generate an \b Extrusion on an object in the <b>Main Menu</b>
select <b>New Entity - > Generation - > Extrusion</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 \n The \b Result of the operation will be a GEOM_Object (edge, face, shell
solid or compsolid). solid or compsolid).
\n Firstly, you can define the <b>Base Shape</b> (a basis of the \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 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, \n The \b Result of the operation will be a GEOM_Object (edge, face,
shell, solid or compsolid). shell, solid or compsolid).
\n <b> Both Directions </b> checkbox allows extruiding the source \n <b> Both Directions </b> checkbox allows extruiding the source
@ -23,7 +24,7 @@ extrusion) + 1 value (dimension).
\image html extrusion1.png \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 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). you don't need to create it in advance).
\n <b> Both Directions </b> checkbox allows extruiding the source \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 \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 and the <b>DX, DY, DZ</b> Vector\n
<b>Both Directions</b> checkbox allows extruding the <b>Both Directions</b> checkbox allows extruding the
source objects both forward and backward. source objects both forward and backward.

View 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 \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 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 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 \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 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 the base shape <b>and the tangent to the path</b> wire remains constant at any point of the

View 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 \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 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 \n <b> Both Directions </b> checkbox allows extruding the source
object both forward and backward. object both forward and backward.
\n The \b Result of the operation will be a GEOM_Object (edge, face, shell, \n The \b Result of the operation will be a GEOM_Object (edge, face, shell,

View File

@ -113,7 +113,7 @@ void GenerationGUI_PipeDlg::Init()
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit2->setText("");
GroupPoints->LineEdit3->setText(""); GroupPoints->LineEdit3->setText("");
myBase = myPath = myVec = GEOM::GEOM_Object::_nil(); myPath = myVec = GEOM::GEOM_Object::_nil();
myOkBase = myOkPath = myOkVec = false; myOkBase = myOkPath = myOkVec = false;
GroupPoints->CheckButton1->setEnabled(false); GroupPoints->CheckButton1->setEnabled(false);
@ -171,6 +171,9 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
break; break;
} }
} }
qApp->processEvents();
updateGeometry();
resize(100,100);
displayPreview(); displayPreview();
} }
@ -240,12 +243,12 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() != 1) if (aSelList.Extent() < 1)
return; return;
// nbSel == 1
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
QString aName = GEOMBase::GetName(aSelectedObject);
if (!testResult || aSelectedObject->_is_nil()) if (!testResult || aSelectedObject->_is_nil())
return; return;
@ -255,6 +258,15 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
return; return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) {
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 || if (S.ShapeType() == TopAbs_COMPSOLID ||
S.ShapeType() == TopAbs_COMPOUND || S.ShapeType() == TopAbs_COMPOUND ||
S.ShapeType() == TopAbs_SOLID || S.ShapeType() == TopAbs_SOLID ||
@ -264,29 +276,21 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
(S.ShapeType() == TopAbs_SHELL || (S.ShapeType() == TopAbs_SHELL ||
S.ShapeType() == TopAbs_VERTEX)) S.ShapeType() == TopAbs_VERTEX))
return; return;
myBase = aSelectedObject;
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
myOkBase = true;
if (!myOkPath)
GroupPoints->PushButton2->click();
else if (!myOkVec)
GroupPoints->PushButton3->click();
} }
else if (myEditCurrentArgument == GroupPoints->LineEdit2 || }
myEditCurrentArgument->setText(aName);
myOkBase = true;
} else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
myEditCurrentArgument == GroupPoints->LineEdit3) { myEditCurrentArgument == GroupPoints->LineEdit3) {
myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false; myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false;
bool myOk = false; bool myOk = false;
QString aName = GEOMBase::GetName(aSelectedObject);
if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){ if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){
myPath = aSelectedObject; myPath = aSelectedObject;
myOkPath = true; myOkPath = true;
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
} } else {
else
{
if (aSelectedObject != myBase) {
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap); aSelMgr->GetIndexes(aSelList.First(), aMap);
if (aMap.Extent() == 1) { if (aMap.Extent() == 1) {
@ -301,13 +305,11 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
getGeomEngine()->GetIShapesOperations(getStudyId()); getGeomEngine()->GetIShapesOperations(getStudyId());
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex); aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
myOk = true; myOk = true;
} } else { // get Object from study
else { // get Object from study
aSelectedObject = aFindedObject; aSelectedObject = aFindedObject;
myOk = true; myOk = true;
} }
} } else {
else {
myOk = true; myOk = true;
if (S.ShapeType() != TopAbs_EDGE) { if (S.ShapeType() != TopAbs_EDGE) {
aSelectedObject = GEOM::GEOM_Object::_nil(); aSelectedObject = GEOM::GEOM_Object::_nil();
@ -318,12 +320,10 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
if (myEditCurrentArgument == GroupPoints->LineEdit2) { if (myEditCurrentArgument == GroupPoints->LineEdit2) {
myPath = aSelectedObject; myPath = aSelectedObject;
myOkPath = myOk; myOkPath = myOk;
} } else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
myVec = aSelectedObject; myVec = aSelectedObject;
myOkVec = myOk; myOkVec = myOk;
} }
}
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
if (myOkPath) { if (myOkPath) {
@ -331,8 +331,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
GroupPoints->PushButton1->click(); GroupPoints->PushButton1->click();
else if (!myOkVec) else if (!myOkVec)
GroupPoints->PushButton3->click(); GroupPoints->PushButton3->click();
} } else if (myOkVec) {
else if (myOkVec) {
if (!myOkBase) if (!myOkBase)
GroupPoints->PushButton1->click(); GroupPoints->PushButton1->click();
else if (!myOkPath) else if (!myOkPath)
@ -340,13 +339,6 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
} }
} }
} }
// clear selection
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
myGeomGUI->getApp()->selectionMgr()->clearSelected();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
displayPreview(); displayPreview();
} }
@ -473,22 +465,24 @@ bool GenerationGUI_PipeDlg::isValid (QString&)
//================================================================================= //=================================================================================
bool GenerationGUI_PipeDlg::execute (ObjectList& objects) 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()); GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
for (int i=0; i < myBaseObjects.length(); i++) {
aBase = myBaseObjects[i];
switch ( getConstructorId() ) { switch ( getConstructorId() ) {
case 0 : case 0 :
anObj = anOper->MakePipe(myBase, myPath); anObj = anOper->MakePipe(aBase, myPath);
break; break;
case 1 : case 1 :
anObj = anOper->MakePipeBiNormalAlongVector(myBase, myPath, myVec); anObj = anOper->MakePipeBiNormalAlongVector(aBase, myPath, myVec);
break; break;
} }
if (!anObj->_is_nil()) if (!anObj->_is_nil())
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
}
return true; return true;
} }

View File

@ -54,7 +54,7 @@ private:
void enterEvent( QEvent* ); void enterEvent( QEvent* );
private: 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 myPath; /* Shape, defining the path */
GEOM::GEOM_Object_var myVec; /* Vector, defining the constant binormal direction */ GEOM::GEOM_Object_var myVec; /* Vector, defining the constant binormal direction */
bool myOkBase; bool myOkBase;

View File

@ -169,7 +169,7 @@ void GenerationGUI_PrismDlg::Init()
GroupPoints3->LineEdit1->setText(""); GroupPoints3->LineEdit1->setText("");
myPoint1 = myPoint2 = myBase = myVec = GEOM::GEOM_Object::_nil(); myPoint1 = myPoint2 = myVec = GEOM::GEOM_Object::_nil();
myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false; myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
// signals and slots connections // signals and slots connections
@ -278,14 +278,9 @@ void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
updateGeometry(); updateGeometry();
resize(minimumSizeHint()); resize(minimumSizeHint());
if (myInitial) {
myInitial = false;
SelectionIntoArgument(); SelectionIntoArgument();
}
else {
displayPreview(); displayPreview();
} }
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
@ -325,17 +320,34 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(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 (getConstructorId() == 0)
{ {
if (aSelList.Extent() != 1) { if (aSelList.Extent() < 1) {
if (myEditCurrentArgument == GroupPoints->LineEdit1) if (myEditCurrentArgument == GroupPoints->LineEdit2)
myOkBase = false;
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
myOkVec = false; myOkVec = false;
return; return;
} }
// nbSel == 1
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
@ -376,26 +388,15 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
} }
} }
if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) {
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myBase = aSelectedObject;
myOkBase = true;
if (!myOkVec)
GroupPoints->PushButton2->click();
}
else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) {
myOkVec = true; myOkVec = true;
myVec = aSelectedObject; myVec = aSelectedObject;
if (!myOkBase)
GroupPoints->PushButton1->click();
} }
} }
else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points
if (aSelList.Extent() != 1) { if (aSelList.Extent() != 1) {
if (myEditCurrentArgument == GroupPoints2->LineEdit1) if (myEditCurrentArgument == GroupPoints2->LineEdit2) {
myOkBase = false;
else if (myEditCurrentArgument == GroupPoints2->LineEdit2) {
myPoint1 = GEOM::GEOM_Object::_nil(); myPoint1 = GEOM::GEOM_Object::_nil();
myOkPnt1 = false; myOkPnt1 = false;
} }
@ -406,7 +407,6 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
return; return;
} }
// nbSel == 1
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object_var aSelectedObject =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
@ -447,13 +447,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
myEditCurrentArgument->setText(aName); myEditCurrentArgument->setText(aName);
if (myEditCurrentArgument == GroupPoints2->LineEdit1) { if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) {
myOkBase = true;
myBase = aSelectedObject;
if (!myOkPnt1)
GroupPoints2->PushButton2->click();
}
else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) {
myOkPnt1 = true; myOkPnt1 = true;
myPoint1 = aSelectedObject; myPoint1 = aSelectedObject;
if (!myOkPnt2) if (!myOkPnt2)
@ -466,25 +460,6 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
GroupPoints2->PushButton1->click(); 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(); displayPreview();
} }
@ -651,59 +626,53 @@ bool GenerationGUI_PrismDlg::isValid (QString& msg)
bool GenerationGUI_PrismDlg::execute (ObjectList& objects) bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
{ {
QStringList aParameters; QStringList aParameters;
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj, aBaseObj;
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
for (int i=0; i < myBaseObjects.length(); i++) {
aBaseObj = myBaseObjects[i];
switch (getConstructorId()) { switch (getConstructorId()) {
case 0: case 0:
if (!myBothway) { if (!myBothway)
anObj = anOper->MakePrismVecH(myBase, myVec, getHeight()); anObj = anOper->MakePrismVecH(aBaseObj, myVec, getHeight());
} else
else { anObj = anOper->MakePrismVecH2Ways(aBaseObj, myVec, getHeight());
anObj = anOper->MakePrismVecH2Ways(myBase, myVec, getHeight());
}
if (!anObj->_is_nil() && !IsPreview()) if (!anObj->_is_nil() && !IsPreview()) {
{
aParameters << GroupPoints->SpinBox_DX->text(); aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData()); anObj->SetParameters(aParameters.join(":").toLatin1().constData());
} }
break; break;
case 1: case 1:
if (!myBothway2) { if (!myBothway2)
anObj = anOper->MakePrismTwoPnt(myBase, myPoint1, myPoint2); anObj = anOper->MakePrismTwoPnt(aBaseObj, myPoint1, myPoint2);
} else
else { anObj = anOper->MakePrismTwoPnt2Ways(aBaseObj, myPoint1, myPoint2);
anObj = anOper->MakePrismTwoPnt2Ways(myBase, myPoint1, myPoint2);
}
break; break;
case 2: case 2:
double dx = GroupPoints3->SpinBox_DX->value(); double dx = GroupPoints3->SpinBox_DX->value();
double dy = GroupPoints3->SpinBox_DY->value(); double dy = GroupPoints3->SpinBox_DY->value();
double dz = GroupPoints3->SpinBox_DZ->value(); double dz = GroupPoints3->SpinBox_DZ->value();
if (!myBothway3) { if (!myBothway3)
anObj = anOper->MakePrismDXDYDZ(myBase, dx, dy, dz); anObj = anOper->MakePrismDXDYDZ(aBaseObj, dx, dy, dz);
} else
else { anObj = anOper->MakePrismDXDYDZ2Ways(aBaseObj, dx, dy, dz);
anObj = anOper->MakePrismDXDYDZ2Ways(myBase, dx, dy, dz);
}
if (!anObj->_is_nil() && !IsPreview()) if (!anObj->_is_nil() && !IsPreview()) {
{
aParameters << GroupPoints3->SpinBox_DX->text(); aParameters << GroupPoints3->SpinBox_DX->text();
aParameters << GroupPoints3->SpinBox_DY->text(); aParameters << GroupPoints3->SpinBox_DY->text();
aParameters << GroupPoints3->SpinBox_DZ->text(); aParameters << GroupPoints3->SpinBox_DZ->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData()); anObj->SetParameters(aParameters.join(":").toLatin1().constData());
} }
break; break;
} }
if (!anObj->_is_nil()) if (!anObj->_is_nil())
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
}
return true; return true;
} }

View File

@ -57,7 +57,7 @@ private:
double getHeight() const; double getHeight() const;
private: 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 myVec; /* Vector, defining the direction */
GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */ GEOM::GEOM_Object_var myPoint1, myPoint2; /* Points for extrusion */

View File

@ -71,7 +71,7 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg (GeometryGUI* theGeometryGUI, QWi
GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget()); GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); 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->TextLabel2->setText(tr("GEOM_AXIS"));
GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE")); GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
GroupPoints->PushButton1->setIcon(image1); GroupPoints->PushButton1->setIcon(image1);
@ -118,7 +118,7 @@ void GenerationGUI_RevolDlg::Init()
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText("");
GroupPoints->LineEdit2->setText(""); GroupPoints->LineEdit2->setText("");
myBase = myAxis = GEOM::GEOM_Object::_nil(); myAxis = GEOM::GEOM_Object::_nil();
myOkBase = myOkAxis = false; myOkBase = myOkAxis = false;
// signals and slots connections // signals and slots connections
@ -219,12 +219,12 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() != 1) if (aSelList.Extent() < 1)
return; return;
// nbSel == 1
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
QString aName = GEOMBase::GetName(aSelectedObject);
if (!testResult || aSelectedObject->_is_nil()) if (!testResult || aSelectedObject->_is_nil())
return; return;
@ -233,17 +233,22 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
if (!GEOMBase::GetShape(aSelectedObject, S) || S.IsNull()) if (!GEOMBase::GetShape(aSelectedObject, S) || S.IsNull())
return; return;
QString aName = GEOMBase::GetName(aSelectedObject);
if (myEditCurrentArgument == GroupPoints->LineEdit1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) {
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)) if (!isAcceptableBase(S))
return; return;
}
myBase = aSelectedObject;
myOkBase = true;
myEditCurrentArgument->setText( aName ); myEditCurrentArgument->setText( aName );
if (!myOkAxis) myOkBase = true;
GroupPoints->PushButton2->click(); }
} }
else if (myEditCurrentArgument == GroupPoints->LineEdit2) { else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
@ -260,13 +265,11 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
getGeomEngine()->GetIShapesOperations(getStudyId()); getGeomEngine()->GetIShapesOperations(getStudyId());
myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
myOkAxis = true; myOkAxis = true;
} } else {
else {
myAxis = aFindedObject; myAxis = aFindedObject;
myOkAxis = true; myOkAxis = true;
} }
} } else {
else {
myOkAxis = true; myOkAxis = true;
if (S.ShapeType() != TopAbs_EDGE) { if (S.ShapeType() != TopAbs_EDGE) {
aSelectedObject = GEOM::GEOM_Object::_nil(); aSelectedObject = GEOM::GEOM_Object::_nil();
@ -280,12 +283,6 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
GroupPoints->PushButton1->click(); 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(); displayPreview();
} }
@ -403,27 +400,26 @@ bool GenerationGUI_RevolDlg::isValid (QString& msg)
//================================================================================= //=================================================================================
bool GenerationGUI_RevolDlg::execute (ObjectList& objects) 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()); GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
if (!myBothway) { for (int i=0; i < myBaseObjects.length(); i++) {
anObj = anOper->MakeRevolutionAxisAngle(myBase, myAxis, getAngle() * PI180); aBase = myBaseObjects[i];
}
else {
anObj = anOper->MakeRevolutionAxisAngle2Ways(myBase, myAxis, getAngle() * PI180);
}
if (!anObj->_is_nil()) if (!myBothway)
{ anObj = anOper->MakeRevolutionAxisAngle(aBase, myAxis, getAngle() * PI180);
if (!IsPreview()) else
{ anObj = anOper->MakeRevolutionAxisAngle2Ways(aBase, myAxis, getAngle() * PI180);
if (!anObj->_is_nil()) {
if (!IsPreview()) {
QStringList aParameters; QStringList aParameters;
aParameters << GroupPoints->SpinBox_DX->text(); aParameters << GroupPoints->SpinBox_DX->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData()); anObj->SetParameters(aParameters.join(":").toLatin1().constData());
} }
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
} }
}
return true; return true;
} }

View File

@ -55,7 +55,7 @@ private:
double getAngle() const; double getAngle() const;
private: private:
GEOM::GEOM_Object_var myBase; /* Base shape */ GEOM::ListOfGO myBaseObjects; /* Base shapes */
GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */ GEOM::GEOM_Object_var myAxis; /* Axis of the revolution */
bool myOkBase; bool myOkBase;
bool myOkAxis; bool myOkAxis;