0022289: EDF 2623 GEOM: Make "MakePipeWithDifferentsSections" available from GUI

This commit is contained in:
kga 2013-10-30 09:48:10 +00:00
parent c5375d29fb
commit 84a06f4f46
7 changed files with 167 additions and 13 deletions

View File

@ -125,6 +125,7 @@ SET( _res_files
partitionplane.png partitionplane.png
pipe.png pipe.png
pipebinormal.png pipebinormal.png
pipesections.png
plane.png plane.png
planeWorking.png planeWorking.png
plane3points.png plane3points.png

BIN
resources/pipesections.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

View File

@ -391,6 +391,10 @@
<source>ICON_DLG_PIPE_BINORMAL</source> <source>ICON_DLG_PIPE_BINORMAL</source>
<translation>pipebinormal.png</translation> <translation>pipebinormal.png</translation>
</message> </message>
<message>
<source>ICON_DLG_PIPE_SECTION</source>
<translation>pipesections.png</translation>
</message>
<message> <message>
<source>ICON_DLG_PLANE_3PNTS</source> <source>ICON_DLG_PLANE_3PNTS</source>
<translation>plane3points.png</translation> <translation>plane3points.png</translation>

View File

@ -675,6 +675,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_LCS</source> <source>GEOM_LCS</source>
<translation>Local coordinate system</translation> <translation>Local coordinate system</translation>
</message> </message>
<message>
<source>GEOM_LOCATIONS</source>
<translation>Locations</translation>
</message>
<message> <message>
<source>GEOM_FACES</source> <source>GEOM_FACES</source>
<translation>Faces</translation> <translation>Faces</translation>
@ -1216,6 +1220,14 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_TARGET_OBJECT</source> <source>GEOM_TARGET_OBJECT</source>
<translation>Target face</translation> <translation>Target face</translation>
</message> </message>
<message>
<source>GEOM_WITH_CONTACT</source>
<translation>With contact</translation>
</message>
<message>
<source>GEOM_WITH_CORRECTION</source>
<translation>With correction</translation>
</message>
<message> <message>
<source>GEOM_OPERATIONS</source> <source>GEOM_OPERATIONS</source>
<translation>Operations</translation> <translation>Operations</translation>

View File

@ -681,6 +681,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_LCS</source> <source>GEOM_LCS</source>
<translation>Système de coordonnées local</translation> <translation>Système de coordonnées local</translation>
</message> </message>
<message>
<source>GEOM_LOCATIONS</source>
<translation type="unfinished">Locations</translation>
</message>
<message> <message>
<source>GEOM_FACES</source> <source>GEOM_FACES</source>
<translation>Faces</translation> <translation>Faces</translation>
@ -1222,6 +1226,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_TARGET_OBJECT</source> <source>GEOM_TARGET_OBJECT</source>
<translation>Face d&apos;objectif</translation> <translation>Face d&apos;objectif</translation>
</message> </message>
<message>
<source>GEOM_WITH_CONTACT</source>
<translation type="unfinished">With contact</translation>
</message>
<message>
<source>GEOM_WITH_CORRECTION</source>
<translation type="unfinished">With correction</translation>
</message>
<message> <message>
<source>GEOM_OPERATIONS</source> <source>GEOM_OPERATIONS</source>
<translation>Opérations</translation> <translation>Opérations</translation>

View File

@ -59,6 +59,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE"))); QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE")));
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_BINORMAL"))); QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_BINORMAL")));
QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE_SECTION")));
setWindowTitle(tr("GEOM_PIPE_TITLE")); setWindowTitle(tr("GEOM_PIPE_TITLE"));
@ -66,8 +67,9 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE")); mainFrame()->GroupConstructors->setTitle(tr("GEOM_PIPE"));
mainFrame()->RadioButton1->setIcon(image0); mainFrame()->RadioButton1->setIcon(image0);
mainFrame()->RadioButton2->setIcon(image2); mainFrame()->RadioButton2->setIcon(image2);
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose); mainFrame()->RadioButton3->setIcon(image3);
mainFrame()->RadioButton3->close(); // mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
// mainFrame()->RadioButton3->close();
GroupPoints = new DlgRef_3Sel1Check(centralWidget()); GroupPoints = new DlgRef_3Sel1Check(centralWidget());
@ -80,9 +82,28 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
GroupPoints->PushButton3->setIcon(image1); GroupPoints->PushButton3->setIcon(image1);
GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES")); GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES"));
GroupMakePoints = new DlgRef_3Sel2Check3Spin(centralWidget());
GroupMakePoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
GroupMakePoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
GroupMakePoints->TextLabel2->setText(tr("GEOM_LOCATIONS"));
GroupMakePoints->TextLabel3->setText(tr("GEOM_PATH_OBJECT"));
GroupMakePoints->PushButton1->setIcon(image1);
GroupMakePoints->PushButton2->setIcon(image1);
GroupMakePoints->PushButton3->setIcon(image1);
GroupMakePoints->CheckBox1->setText(tr("GEOM_WITH_CONTACT"));
GroupMakePoints->CheckBox2->setText(tr("GEOM_WITH_CORRECTION"));
GroupMakePoints->SpinBox1->close();
GroupMakePoints->SpinBox2->close();
GroupMakePoints->SpinBox3->close();
GroupMakePoints->TextLabel4->close();
GroupMakePoints->TextLabel5->close();
GroupMakePoints->TextLabel6->close();
QVBoxLayout* layout = new QVBoxLayout(centralWidget()); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6); layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints); layout->addWidget(GroupPoints);
layout->addWidget(GroupMakePoints);
/***************************************************************/ /***************************************************************/
setHelpFileName("create_extrusion_alongpath_page.html"); setHelpFileName("create_extrusion_alongpath_page.html");
@ -119,6 +140,14 @@ void GenerationGUI_PipeDlg::Init()
GroupPoints->CheckButton1->setEnabled(false); GroupPoints->CheckButton1->setEnabled(false);
GroupMakePoints->LineEdit1->setReadOnly(true);
GroupMakePoints->LineEdit2->setReadOnly(true);
GroupMakePoints->LineEdit3->setReadOnly(true);
GroupMakePoints->LineEdit1->setText("");
GroupMakePoints->LineEdit2->setText("");
GroupMakePoints->LineEdit3->setText("");
showOnlyPreviewControl(); showOnlyPreviewControl();
// signals and slots connections // signals and slots connections
@ -133,6 +162,10 @@ void GenerationGUI_PipeDlg::Init()
connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked())); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
connect(GroupMakePoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupMakePoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupMakePoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
initName(tr("GEOM_PIPE")); initName(tr("GEOM_PIPE"));
resize(100,100); resize(100,100);
@ -155,15 +188,25 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
switch (constructorId) { switch (constructorId) {
case 0: case 0:
GroupMakePoints->hide();
GroupPoints->show();
GroupPoints->TextLabel3->hide(); GroupPoints->TextLabel3->hide();
GroupPoints->PushButton3->hide(); GroupPoints->PushButton3->hide();
GroupPoints->LineEdit3->hide(); GroupPoints->LineEdit3->hide();
GroupPoints->PushButton1->click(); GroupPoints->PushButton1->click();
break; break;
case 1: case 1:
GroupMakePoints->hide();
GroupPoints->show();
GroupPoints->TextLabel3->show(); GroupPoints->TextLabel3->show();
GroupPoints->PushButton3->show(); GroupPoints->PushButton3->show();
GroupPoints->LineEdit3->show(); GroupPoints->LineEdit3->show();
GroupPoints->PushButton1->click();
break;
case 2:
GroupPoints->hide();
GroupMakePoints->show();
GroupMakePoints->PushButton1->click();
break; break;
default: default:
break; break;
@ -224,7 +267,7 @@ bool GenerationGUI_PipeDlg::ClickOnApply()
if ( getConstructorId() != 1 ) if ( getConstructorId() != 1 )
ConstructorsClicked( getConstructorId() ); ConstructorsClicked( getConstructorId() );
// activate selection and connect selection manager // activate selection and connect selection manager
GroupPoints->PushButton1->click(); // GroupPoints->PushButton1->click();
return true; return true;
} }
@ -277,6 +320,43 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
GroupPoints->PushButton2->click(); GroupPoints->PushButton2->click();
} }
} }
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit1 ) {
myBaseObjects.clear();
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
for ( int i = 0; i < objects.count(); i++ ) {
GEOM::shape_type stype = objects[i]->GetMaxShapeType();
if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
continue;
myBaseObjects << objects[i];
}
if ( !myBaseObjects.isEmpty() ) {
QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
myEditCurrentArgument->setText( aName );
}
}
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) {
myLocations.clear();
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
for ( int i = 0; i < objects.count(); i++ ) {
GEOM::shape_type stype = objects[i]->GetMaxShapeType();
if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
continue;
myLocations << objects[i];
}
if ( !myLocations.isEmpty() ) {
QString aName = myLocations.count() > 1 ? QString( "%1_objects").arg( myLocations.count() ) : GEOMBase::GetName( myLocations[0].get() );
myEditCurrentArgument->setText( aName );
}
}
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit3 ) {
QList<TopAbs_ShapeEnum> types;
types << TopAbs_EDGE << TopAbs_WIRE;
myPath = getSelected( types );
if ( myPath ) {
QString aName = GEOMBase::GetName( myPath.get() );
myEditCurrentArgument->setText( aName );
}
}
processPreview(); processPreview();
} }
@ -320,6 +400,23 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
GroupPoints->CheckButton1->setEnabled(false); GroupPoints->CheckButton1->setEnabled(false);
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
} }
GroupMakePoints->PushButton1->setDown(false);
GroupMakePoints->PushButton2->setDown(false);
GroupMakePoints->PushButton3->setDown(false);
GroupMakePoints->LineEdit1->setEnabled(false);
GroupMakePoints->LineEdit2->setEnabled(false);
GroupMakePoints->LineEdit3->setEnabled(false);
if (send == GroupMakePoints->PushButton1) {
myEditCurrentArgument = GroupMakePoints->LineEdit1;
}
else if(send == GroupMakePoints->PushButton2) {
myEditCurrentArgument = GroupMakePoints->LineEdit2;
}
else if (send == GroupMakePoints->PushButton3) {
myEditCurrentArgument = GroupMakePoints->LineEdit3;
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
@ -379,6 +476,9 @@ bool GenerationGUI_PipeDlg::isValid (QString&)
case 1 : case 1 :
ok = !myBaseObjects.isEmpty() && myPath && myVec; ok = !myBaseObjects.isEmpty() && myPath && myVec;
break; break;
case 2 :
ok = !myBaseObjects.isEmpty() && ( myLocations.isEmpty() || myBaseObjects.count() == myLocations.count() ) && myPath;
break;
default: default:
break; break;
} }
@ -394,19 +494,41 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj; GEOM::GEOM_Object_var anObj;
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
switch( getConstructorId() ) {
for (int i = 0; i < myBaseObjects.count(); i++) { case 0:
switch ( getConstructorId() ) { case 1:
case 0 : for (int i = 0; i < myBaseObjects.count(); i++) {
anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get()); switch ( getConstructorId() ) {
break; case 0 :
case 1 : anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get());
anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get()); break;
break; case 1 :
} anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get());
break;
}
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
break;
case 2:
GEOM::ListOfGO_var myBaseGO = new GEOM::ListOfGO();
GEOM::ListOfGO_var myLocationsGO = new GEOM::ListOfGO();
myBaseGO->length( myBaseObjects.count() );
myLocationsGO->length( myLocations.count() );
for (int i = 0; i < myBaseObjects.count(); i++) {
myBaseGO[i] = myBaseObjects[i].copy();
}
for (int i = 0; i < myLocations.count(); i++) {
myLocationsGO[i] = myLocations[i].copy();
}
anObj = anOper->MakePipeWithDifferentSections(myBaseGO.in(), myLocationsGO.in(), myPath.get(), GroupMakePoints->CheckBox1->isChecked(), GroupMakePoints->CheckBox2->isChecked());
if (!anObj->_is_nil()) if (!anObj->_is_nil())
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
break;
default:
break;
} }
return true; return true;
} }

View File

@ -31,6 +31,7 @@
#include "GEOM_GenericObjPtr.h" #include "GEOM_GenericObjPtr.h"
class DlgRef_3Sel1Check; class DlgRef_3Sel1Check;
class DlgRef_3Sel2Check3Spin;
//================================================================================= //=================================================================================
// class : GenerationGUI_PipeDlg // class : GenerationGUI_PipeDlg
@ -60,8 +61,10 @@ private:
QList<GEOM::GeomObjPtr> myBaseObjects; /* Base shapes */ QList<GEOM::GeomObjPtr> myBaseObjects; /* Base shapes */
GEOM::GeomObjPtr myPath; /* Shape, defining the path */ GEOM::GeomObjPtr myPath; /* Shape, defining the path */
GEOM::GeomObjPtr myVec; /* Vector, defining the constant binormal direction */ GEOM::GeomObjPtr myVec; /* Vector, defining the constant binormal direction */
QList<GEOM::GeomObjPtr> myLocations; /* Locations on the path corresponding specified list of the Base shapes */
DlgRef_3Sel1Check* GroupPoints; DlgRef_3Sel1Check* GroupPoints;
DlgRef_3Sel2Check3Spin* GroupMakePoints;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();