diff --git a/doc/salome/gui/GEOM/images/point3.png b/doc/salome/gui/GEOM/images/point3.png
old mode 100755
new mode 100644
index 8b4daecc1..57cccab0a
Binary files a/doc/salome/gui/GEOM/images/point3.png and b/doc/salome/gui/GEOM/images/point3.png differ
diff --git a/doc/salome/gui/GEOM/input/creating_point.doc b/doc/salome/gui/GEOM/input/creating_point.doc
index cc8790624..5929a8fd1 100644
--- a/doc/salome/gui/GEOM/input/creating_point.doc
+++ b/doc/salome/gui/GEOM/input/creating_point.doc
@@ -28,9 +28,10 @@ the position of this point regarding the reference one.
\n Thirdly, we can define a point by an \b Edge and a \b Parameter
indicating its position on the Edge, ranging from 0.0 to 1.0. For example, 0.5 means that the
point is located in the middle of the edge.
-\n TUI Command: geompy.MakeVertexOnCurve(Edge,Parameter).
+\n TUI Command: geompy.MakeVertexOnCurve(Edge,Parameter,takeOrientationIntoAccount).
\n Arguments: Name + 1 edge + 1 Parameter defining the
-position of the point on the given edge.
+position of the point on the given edge + flag that tells if it is necessary
+to take the edge orientation into account.
\image html point3.png
Alternatively, it is possible to define a point by an \b Edge and a \b Length.
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index c301b79ae..d7c643562 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -732,10 +732,13 @@ module GEOM
* Create a point, corresponding to the given parameter on the given curve.
* \param theRefCurve The referenced curve.
* \param theParameter Value of parameter on the referenced curve.
+ * \param takeOrientationIntoAccount flag that tells if it is necessary
+ * to take the curve's orientation into account.
* \return New GEOM_Object, containing the created point.
*/
GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve,
- in double theParameter);
+ in double theParameter,
+ in boolean takeOrientationIntoAccount);
/*!
* \brief Create a point, corresponding to the given length on the given curve.
diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx
index 983666d28..0a374c4d7 100644
--- a/src/BasicGUI/BasicGUI_PointDlg.cxx
+++ b/src/BasicGUI/BasicGUI_PointDlg.cxx
@@ -125,13 +125,17 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren
GroupXYZ->TextLabel2->setText(tr("GEOM_Y"));
GroupXYZ->TextLabel3->setText(tr("GEOM_Z"));
- GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
+ GroupOnCurve = new DlgRef_2Sel1Spin2Check(centralWidget());
GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE"));
GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
GroupOnCurve->PushButton1->setIcon(image2);
GroupOnCurve->PushButton2->setIcon(image2);
+ GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
+ GroupOnCurve->CheckButton1->setText(tr("GEOM_TAKE_ORIENTATION_INTO_ACCOUNT"));
+ GroupOnCurve->CheckButton2->setAttribute( Qt::WA_DeleteOnClose );
+ GroupOnCurve->CheckButton2->close();
GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget());
GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE"));
@@ -258,6 +262,7 @@ void BasicGUI_PointDlg::Init()
initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision");
GroupOnCurve->SpinBox_DX->setValue(0.5);
+ GroupOnCurve->CheckButton1->setChecked(true);
initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision");
GroupOnSurface->SpinBox_DX->setValue(0.5);
@@ -275,6 +280,8 @@ void BasicGUI_PointDlg::Init()
connect(myParamCoord, SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int)));
+ connect(GroupOnCurve->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CheckBoxClicked()));
+
connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupOnCurve->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupOnSurface->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
@@ -669,7 +676,7 @@ void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
// function : CheckBoxClicked()
// purpose : Check Boxes Management
//=================================================================================
-void BasicGUI_PointDlg::CheckBoxClicked(int State)
+void BasicGUI_PointDlg::CheckBoxClicked()
{
displayPreview(true);
}
@@ -821,7 +828,9 @@ bool BasicGUI_PointDlg::execute(ObjectList& objects)
case GEOM_POINT_EDGE :
{
if (myParamCoord->checkedId() == PARAM_VALUE) {
- anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter());
+ bool isUseOrientation = GroupOnCurve->CheckButton1->isChecked();
+
+ anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter(), isUseOrientation);
aParameters<SpinBox_DX->text();
}
else if (myParamCoord->checkedId() == LENGTH_VALUE) {
@@ -973,6 +982,7 @@ void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
GroupOnCurve->LineEdit2->setVisible(isLength);
GroupOnCurve->TextLabel3->setVisible(isParam || isLength);
GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength);
+ GroupOnCurve->CheckButton1->setVisible(isParam);
if (isParam){
initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision");
GroupOnCurve->SpinBox_DX->setValue(0.5);
diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h
index 7002333db..ffc01a165 100644
--- a/src/BasicGUI/BasicGUI_PointDlg.h
+++ b/src/BasicGUI/BasicGUI_PointDlg.h
@@ -31,7 +31,7 @@
#include "GEOM_GenericObjPtr.h"
#include
-class DlgRef_2Sel1Spin;
+class DlgRef_2Sel1Spin2Check;
class DlgRef_3Spin;
class DlgRef_2Sel;
class DlgRef_1Sel3Spin;
@@ -88,7 +88,7 @@ private:
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
- DlgRef_2Sel1Spin* GroupOnCurve;
+ DlgRef_2Sel1Spin2Check* GroupOnCurve;
DlgRef_2Sel* GroupLineIntersection;
DlgRef_1Sel2Spin* GroupOnSurface;
@@ -115,7 +115,7 @@ private slots:
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
void ClickParamCoord( int );
- void CheckBoxClicked( int );
+ void CheckBoxClicked();
void updateSize();
};
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index 9bed663c4..d9ce747c7 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -1352,6 +1352,10 @@ Please, select face, shell or solid and try again
GEOM_LENGTH_VALUE
By length
+
+ GEOM_TAKE_ORIENTATION_INTO_ACCOUNT
+ Take edge orientation into account
+
GEOM_PARTITION
Partition
diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
index 576ba74af..8f282f2ae 100644
--- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
@@ -186,10 +186,11 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
(Handle(GEOM_Object) theGeomObj,
- double theParam1,
- double theParam2,
- double theParam3,
+ double theParam1,
+ double theParam2,
+ double theParam3,
const PointLocation theLocation,
+ const bool takeOrientationIntoAccount,
Handle(GEOM_Object) theRefPoint)
{
SetErrorCode(KO);
@@ -226,6 +227,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
case PointOn_CurveByParam:
aPI.SetCurve(aRefFunction);
aPI.SetParameter(theParam1);
+ aPI.SetTakeOrientationIntoAccount(takeOrientationIntoAccount);
break;
case PointOn_CurveByLength:
aPI.SetCurve(aRefFunction);
@@ -277,7 +279,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
{
case PointOn_CurveByParam:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
- << theGeomObj << ", " << theParam1 << ")";
+ << theGeomObj << ", " << theParam1 << ", "
+ << takeOrientationIntoAccount << ")";
break;
case PointOn_CurveByLength:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
@@ -315,9 +318,12 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
- (Handle(GEOM_Object) theCurve, double theParameter)
+ (Handle(GEOM_Object) theCurve,
+ double theParameter,
+ bool takeOrientationIntoAccount)
{
- return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
+ return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam,
+ takeOrientationIntoAccount);
}
//=============================================================================
@@ -344,7 +350,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
double theLength,
Handle(GEOM_Object) theStartPoint)
{
- return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theStartPoint);
+ return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength,
+ false, theStartPoint);
}
//=============================================================================
diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
index e3960f2f5..df8051ab6 100644
--- a/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
@@ -40,8 +40,10 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) MakePointWithReference (Handle(GEOM_Object) theReference,
double theX, double theY, double theZ);
- Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve,
- double theParameter);
+ Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve
+ (Handle(GEOM_Object) theCurve,
+ double theParameter,
+ bool takeOrientationIntoAccount);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve,
double theLength,
@@ -134,12 +136,14 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
PointOn_Face
};
- Handle(GEOM_Object) makePointOnGeom (Handle(GEOM_Object) theGeomObj,
- double theParam1,
- double theParam2,
- double theParam3,
- const PointLocation theLocation,
- Handle(GEOM_Object) theRefPoint = 0);
+ Handle(GEOM_Object) makePointOnGeom
+ (Handle(GEOM_Object) theGeomObj,
+ double theParam1,
+ double theParam2,
+ double theParam3,
+ const PointLocation theLocation,
+ const bool takeOrientationIntoAccount = false,
+ Handle(GEOM_Object) theRefPoint = 0);
};
#endif
diff --git a/src/GEOMImpl/GEOMImpl_IPoint.hxx b/src/GEOMImpl/GEOMImpl_IPoint.hxx
old mode 100755
new mode 100644
index 650330272..07f81f000
--- a/src/GEOMImpl/GEOMImpl_IPoint.hxx
+++ b/src/GEOMImpl/GEOMImpl_IPoint.hxx
@@ -40,7 +40,7 @@
#define ARG_LENGTH 11
-//#define ARG_FLAG 12
+#define ARG_USE_ORIENTATION 12
class GEOMImpl_IPoint
{
@@ -73,12 +73,13 @@ class GEOMImpl_IPoint
void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); }
void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); }
void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); }
- //void SetReversed(bool theReversed) { _func->SetInteger(ARG_FLAG, theReversed); }
+ void SetTakeOrientationIntoAccount(bool takeOrientationIntoAccount)
+ { _func->SetInteger(ARG_USE_ORIENTATION, takeOrientationIntoAccount); }
double GetParameter() { return _func->GetReal(ARG_PARAM); }
double GetParameter2() { return _func->GetReal(ARG_PARAM2); }
double GetLength() { return _func->GetReal(ARG_LENGTH); }
- //bool GetReversed() { return _func->GetInteger(ARG_FLAG); }
+ bool GetTakeOrientationIntoAccount() { return _func->GetInteger(ARG_USE_ORIENTATION); }
private:
diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx
index 03edfc4c1..f80ba42b9 100644
--- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx
+++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx
@@ -145,7 +145,14 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
Standard_Real aFP, aLP, aP;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP);
if ( !aCurve.IsNull() ) {
- aP = aFP + (aLP - aFP) * aPI.GetParameter();
+ if (aPI.GetTakeOrientationIntoAccount() &&
+ aRefShape.Orientation() == TopAbs_REVERSED) {
+ aP = 1. - aPI.GetParameter();
+ } else {
+ aP = aPI.GetParameter();
+ }
+
+ aP = aFP + (aLP - aFP) * aP;
aPnt = aCurve->Value(aP);
}
else {
@@ -393,6 +400,7 @@ GetCreationInformation(std::string& theOperationName,
case POINT_CURVE_PAR:
AddParam( theParams, "Edge", aCI.GetCurve() );
AddParam( theParams, "Parameter", aCI.GetParameter() );
+ AddParam( theParams, "Use Orientation", aCI.GetTakeOrientationIntoAccount() );
break;
case POINT_CURVE_COORD:
AddParam( theParams, "X", aCI.GetX() );
diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc
index 1dcf544f9..b48adfff4 100644
--- a/src/GEOM_I/GEOM_IBasicOperations_i.cc
+++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc
@@ -135,7 +135,9 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
- (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter)
+ (GEOM::GEOM_Object_ptr theCurve,
+ CORBA::Double theParameter,
+ CORBA::Boolean takeOrientationIntoAccount)
{
GEOM::GEOM_Object_var aGEOMObject;
@@ -147,8 +149,8 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
if (aReference.IsNull()) return aGEOMObject._retn();
//Create the point
- Handle(GEOM_Object) anObject =
- GetOperations()->MakePointOnCurve(aReference, theParameter);
+ Handle(GEOM_Object) anObject = GetOperations()->MakePointOnCurve
+ (aReference, theParameter, takeOrientationIntoAccount);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.hh b/src/GEOM_I/GEOM_IBasicOperations_i.hh
index ec55aee27..c3e1fa3ff 100644
--- a/src/GEOM_I/GEOM_IBasicOperations_i.hh
+++ b/src/GEOM_I/GEOM_IBasicOperations_i.hh
@@ -52,8 +52,10 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i :
CORBA::Double theY,
CORBA::Double theZ);
- GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve,
- CORBA::Double theParameter);
+ GEOM::GEOM_Object_ptr MakePointOnCurve
+ (GEOM::GEOM_Object_ptr theCurve,
+ CORBA::Double theParameter,
+ CORBA::Boolean takeOrientationIntoAccount);
GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theCurve,
CORBA::Double theLength,
diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc
index 8501474d8..bfd598ad5 100644
--- a/src/GEOM_I_Superv/GEOM_Superv_i.cc
+++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc
@@ -722,7 +722,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the
beginService( " GEOM_Superv_i::MakePointOnCurve" );
MESSAGE("GEOM_Superv_i::MakePointOnCurve");
getBasicOp();
- GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter);
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter, false);
endService( " GEOM_Superv_i::MakePointOnCurve" );
return anObj;
}
diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py
index 0a3d2c832..0e8257dec 100644
--- a/src/GEOM_SWIG/geomBuilder.py
+++ b/src/GEOM_SWIG/geomBuilder.py
@@ -1148,6 +1148,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
## Create a point, corresponding to the given parameter on the given curve.
# @param theRefCurve The referenced curve.
# @param theParameter Value of parameter on the referenced curve.
+ # @param takeOrientationIntoAccount flag that tells if it is necessary
+ # to take the curve's orientation into account for the
+ # operation. I.e. if this flag is set, the results for the same
+ # parameters (except the value 0.5) is different for forward
+ # and reversed curves. If it is not set the result is the same.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
@@ -1156,13 +1161,20 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
#
# @ref tui_creation_point "Example"
@ManageTransactions("BasicOp")
- def MakeVertexOnCurve(self, theRefCurve, theParameter, theName=None):
+ def MakeVertexOnCurve(self, theRefCurve, theParameter,
+ takeOrientationIntoAccount=False, theName=None):
"""
Create a point, corresponding to the given parameter on the given curve.
Parameters:
theRefCurve The referenced curve.
theParameter Value of parameter on the referenced curve.
+ takeOrientationIntoAccount flag that tells if it is necessary
+ to take the curve's orientation into account for the
+ operation. I.e. if this flag is set, the results for
+ the same parameters (except the value 0.5) is different
+ for forward and reversed curves. If it is not set
+ the result is the same.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
@@ -1174,8 +1186,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
"""
# Example: see GEOM_TestAll.py
- theParameter, Parameters = ParseParameters(theParameter)
- anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
+ theParameter, takeOrientationIntoAccount, Parameters = ParseParameters(
+ theParameter, takeOrientationIntoAccount)
+ anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter,
+ takeOrientationIntoAccount)
RaiseIfFailed("MakePointOnCurve", self.BasicOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "vertex")