Mantis issue 0021394: EDF 1637 GEOM: Function 'MinDistance' with creation of vertices

This commit is contained in:
jfa 2013-01-18 14:36:27 +00:00
parent 7d2fc6b422
commit 32ceab19f3
4 changed files with 39 additions and 19 deletions

View File

@ -3,16 +3,29 @@
\page min_distance_page Min. Distance
Returns the minimum distance between two geometrical objects and
the coordinates of the vector of distance and shows the vector in the viewer.
the coordinates of the vector of distance and shows the distance in
the viewer.
\note The minimal distance searching task can have one or more
solutions, and also it can have an infinite set of solutions. All
found solutions are listed in dedicated combobox. When the user
selects any one of found solutions, presentation is displayed in the
OCC viewer and fields "Length", "DX", "DY" and "DZ" are filled with
corresponding values. If there are no solutions found, text "No
solution found" will be shown instead of solutions list; this could
mean what the task has an infinite number of solutions.
\n \note Currently used OCCT functionality finds finite number of
solutions even in cases, where an infinite set of solutions exists.
\n On \b Apply or <b>Apply and Close</b> it creates a set of closest
points of the shapes.
points of the shapes, corresponding to all found solutions.
<b>TUI Commands:</b>
\n<em>aDist = geompy.MinDistance(Shape1, Shape2),</em>
\n<em>[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Shape1, Shape2),</em>
\n<em>[nbSols, (x11, y11, z11, x21, y21, z21, ...)] = geompy.ClosestPoints(Shape1, Shape2),</em>
where \em Shape1 and \em Shape2 are shapes between which the minimal
\n where \em Shape1 and \em Shape2 are shapes between which the minimal
distance is computed.
See also a \ref tui_min_distance_page "TUI example".

View File

@ -1074,6 +1074,14 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_MIN</source>
<translation>Min :</translation>
</message>
<message>
<source>GEOM_MINDIST_NAME</source>
<translation>MinDist</translation>
</message>
<message>
<source>GEOM_MINDIST_NO_SOL</source>
<translation>No solution found</translation>
</message>
<message>
<source>GEOM_MINDIST_OBJ</source>
<translation>Objects And Results</translation>
@ -1082,10 +1090,6 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_MINDIST_TITLE</source>
<translation>Minimun Distance Between Two Objects</translation>
</message>
<message>
<source>GEOM_MINDIST_NAME</source>
<translation>MinDist</translation>
</message>
<message>
<source>GEOM_MIRROR</source>
<translation>Mirror</translation>
@ -1210,6 +1214,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SOLUTION</source>
<translation>Solution :</translation>
</message>
<message>
<source>GEOM_SOLUTION_I</source>
<translation>Solution %1</translation>
</message>
<message>
<source>GEOM_TARGET_OBJECT</source>
<translation>Target face</translation>

View File

@ -102,10 +102,6 @@ MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* paren
myGrp->LineEdit4->setReadOnly(true);
myGrp->LineEdit5->setReadOnly(true);
myGrp->LineEdit6->setReadOnly(true);
QVBoxLayout* layout = new QVBoxLayout (centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(myGrp);
/***************************************************************/
myHelpFileName = "min_distance_page.html";
@ -129,6 +125,7 @@ MeasureGUI_DistanceDlg::~MeasureGUI_DistanceDlg()
void MeasureGUI_DistanceDlg::Init()
{
myEditCurrentArgument = myGrp->LineEdit1;
myDbls = new GEOM::ListOfDouble();
// signals and slots connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@ -200,7 +197,7 @@ void MeasureGUI_DistanceDlg::enterEvent(QEvent*)
//=================================================================================
void MeasureGUI_DistanceDlg::SolutionSelected (int i)
{
if (i < 0 || myDbls->length() <= i*6) {
if (i < 0 || myDbls->length() < (i+1)*6) {
myGrp->LineEdit3->setText("");
myGrp->LineEdit4->setText("");
myGrp->LineEdit5->setText("");
@ -303,6 +300,7 @@ void MeasureGUI_DistanceDlg::processObject()
myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
myGrp->ComboBox1->clear();
myDbls->length(0);
erasePreview();
int nbSols = 0;
@ -319,9 +317,13 @@ void MeasureGUI_DistanceDlg::processObject()
return;
}
if (anOper->IsDone() && nbSols > 0) {
if (!anOper->IsDone())
myGrp->ComboBox1->addItem(tr(anOper->GetErrorCode()));
else if (nbSols <= 0)
myGrp->ComboBox1->addItem(tr("GEOM_MINDIST_NO_SOL"));
else {
for (int i = 0; i < nbSols; i++) {
myGrp->ComboBox1->addItem(QString("Solution %1").arg(i + 1));
myGrp->ComboBox1->addItem(tr("GEOM_SOLUTION_I").arg(i + 1));
}
myGrp->ComboBox1->setCurrentIndex(0);
}
@ -337,7 +339,8 @@ SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
int currSol = myGrp->ComboBox1->currentIndex();
if (myObj1->_is_nil() || myObj2->_is_nil() || currSol == -1 ||
if (myObj1->_is_nil() || myObj2->_is_nil() ||
currSol == -1 || (currSol+1)*6 > myDbls->length() ||
vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
return 0;

View File

@ -88,10 +88,6 @@ TransformationGUI_MultiRotationDlg::TransformationGUI_MultiRotationDlg
GroupArgs->LineEdit2->setReadOnly(true);
GroupArgs->SpinBox_DX1->setEnabled(isAngleStep);
GroupArgs->CheckButton1->setEnabled(isAngleStep);
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupArgs);
/***************************************************************/
setHelpFileName("multi_rotation_operation_page.html");