\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".
<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>
<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>
<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>
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";
void MeasureGUI_DistanceDlg::Init()
{
myEditCurrentArgument = myGrp->LineEdit1;
+ myDbls = new GEOM::ListOfDouble();
// signals and slots connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
//=================================================================================
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("");
myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
myGrp->ComboBox1->clear();
+ myDbls->length(0);
erasePreview();
int nbSols = 0;
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);
}
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;
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");