\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 <b>TUI Command:</b> <em>geompy.MakeVertexOnCurve(Edge,Parameter).</em>
+\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurve(Edge,Parameter,takeOrientationIntoAccount).</em>
\n <b>Arguments:</b> 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.
* 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.
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"));
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);
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()));
// function : CheckBoxClicked()
// purpose : Check Boxes Management
//=================================================================================
-void BasicGUI_PointDlg::CheckBoxClicked(int State)
+void BasicGUI_PointDlg::CheckBoxClicked()
{
displayPreview(true);
}
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<<GroupOnCurve->SpinBox_DX->text();
}
else if (myParamCoord->checkedId() == LENGTH_VALUE) {
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);
#include "GEOM_GenericObjPtr.h"
#include <QMap>
-class DlgRef_2Sel1Spin;
+class DlgRef_2Sel1Spin2Check;
class DlgRef_3Spin;
class DlgRef_2Sel;
class DlgRef_1Sel3Spin;
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
- DlgRef_2Sel1Spin* GroupOnCurve;
+ DlgRef_2Sel1Spin2Check* GroupOnCurve;
DlgRef_2Sel* GroupLineIntersection;
DlgRef_1Sel2Spin* GroupOnSurface;
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
void ClickParamCoord( int );
- void CheckBoxClicked( int );
+ void CheckBoxClicked();
void updateSize();
};
<source>GEOM_LENGTH_VALUE</source>
<translation>By length</translation>
</message>
+ <message>
+ <source>GEOM_TAKE_ORIENTATION_INTO_ACCOUNT</source>
+ <translation>Take edge orientation into account</translation>
+ </message>
<message>
<source>GEOM_PARTITION</source>
<translation>Partition</translation>
//=============================================================================
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);
case PointOn_CurveByParam:
aPI.SetCurve(aRefFunction);
aPI.SetParameter(theParam1);
+ aPI.SetTakeOrientationIntoAccount(takeOrientationIntoAccount);
break;
case PointOn_CurveByLength:
aPI.SetCurve(aRefFunction);
{
case PointOn_CurveByParam:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
- << theGeomObj << ", " << theParam1 << ")";
+ << theGeomObj << ", " << theParam1 << ", "
+ << takeOrientationIntoAccount << ")";
break;
case PointOn_CurveByLength:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
*/
//=============================================================================
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);
}
//=============================================================================
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);
}
//=============================================================================
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,
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
#define ARG_LENGTH 11
-//#define ARG_FLAG 12
+#define ARG_USE_ORIENTATION 12
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:
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 {
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() );
*/
//=============================================================================
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;
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();
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,
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;
}
## 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.
#
# @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.
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")