mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-19 04:00:33 +05:00
0020632: EDF 1173 GEOM : Extrusion with multiple selection
This commit is contained in:
parent
750c683d6f
commit
87e982be73
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
myOkBase = false;
|
||||
GEOMBase::ConvertListOfIOInListOfGO(aSelList, myBaseObjects, true);
|
||||
if (aSelList.Extent() > 1)
|
||||
aName = QString( "%1_objects").arg( aSelList.Extent() );
|
||||
|
||||
myBase = aSelectedObject;
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
|
||||
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;
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aName);
|
||||
} 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 (myOkPath) {
|
||||
if (!myOkBase)
|
||||
GroupPoints->PushButton1->click();
|
||||
else if (!myOkVec)
|
||||
GroupPoints->PushButton3->click();
|
||||
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 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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
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;
|
||||
}
|
||||
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());
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
objects.push_back(anObj._retn());
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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;
|
||||
myOkBase = false;
|
||||
if (aSelList.Extent() > 1)
|
||||
aName = QString( "%1_objects").arg( aSelList.Extent() );
|
||||
|
||||
myBase = aSelectedObject;
|
||||
myOkBase = true;
|
||||
myEditCurrentArgument->setText(aName);
|
||||
if (!myOkAxis)
|
||||
GroupPoints->PushButton2->click();
|
||||
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);
|
||||
}
|
||||
for (int i=0; i < myBaseObjects.length(); i++) {
|
||||
aBase = myBaseObjects[i];
|
||||
|
||||
if (!anObj->_is_nil())
|
||||
{
|
||||
if (!IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupPoints->SpinBox_DX->text();
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user