Alternatively, it is possible to define the point by \b Edge and \b Length,
the given length must not exceed the length of the edge. The orientation of the edge can be reversed.
-\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurveByLength(Edge,Length,Direction).</em>
+\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurveByLength(Edge,Length,Reverse).</em>
\n <b>Arguments:</b> Name + 1 edge + 1 Length defining the
-position of the point on the given edge + 1 Direction for the calculation of the length (0 = forward, 2 = reversed).
+position of the point on the given edge + 1 Reverse flag defining the direction for the
+calculation of the length (False = forward, True = reversed).
\image html point3_3.png
It is also possible to define 3D coordinates of the point
# create a vertex by parameter
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
# create a vertex by length
-p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., 0)
+p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., False)
#create a vertex by point projection
p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
* Create a point, corresponding to the given length on the given curve.
* \param theRefCurve The referenced curve.
* \param theLength Length on the referenced curve.
- * \param theDirection Direction for the calculation of the length (0 = forward or 2 = reversed).
+ * \param theReverse Direction for the calculation of the length (false = forward or true = reversed).
* \return New GEOM_Object, containing the created point.
*/
GEOM_Object MakePointOnCurveByLength (in GEOM_Object theRefCurve,
in double theLength,
- in double theDirection);
+ in boolean theReverse);
/*!
* Create a point on the given curve, projecting given point
myNeedType = TopAbs_VERTEX;
myEditCurrentArgument = 0;
- myCheckFlag = 0;
/* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
//=================================================================================
void BasicGUI_PointDlg::CheckBoxClicked( int State )
{
- myCheckFlag = State;
displayPreview();
}
aParameters<<GroupOnCurve->SpinBox_DX->text();
}
else if ( myParamCoord->checkedId() == LENGTH_VALUE ) {
- anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), myCheckFlag );
+ bool reversed = GroupOnCurve->CheckButton1->isChecked();
+ anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), reversed );
- std::stringstream out;
- out<<myCheckFlag;
- std::string flag = out.str();
aParameters<<GroupOnCurve->SpinBox_DX->text();
- aParameters<<flag.c_str();
+ aParameters<<QString::number( reversed );
}
else if ( myParamCoord->checkedId() == COORD_VALUE ) {
double x = GroupXYZ->SpinBox_DX->value();
bool myBusy;
- int myCheckFlag;
-
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
DlgRef_1Sel1Spin1Check* GroupOnCurve;
double theParam1,
double theParam2,
double theParam3,
- int theFlag1,
- const PointLocation theLocation)
+ const PointLocation theLocation,
+ bool theReverse)
{
SetErrorCode(KO);
case PointOn_CurveByLength:
aPI.SetCurve(aRefFunction);
aPI.SetLength(theParam1);
- aPI.SetFlag(theFlag1);
+ aPI.SetReversed(theReverse);
break;
case PointOn_CurveByCoord:
aPI.SetCurve(aRefFunction);
break;
case PointOn_CurveByLength:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
- << theGeomObj << ", " << theParam1 << ", " << theFlag1 << ")";
+ << theGeomObj << ", " << theParam1 << ", " << theReverse << ")";
break;
case PointOn_CurveByCoord:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
(Handle(GEOM_Object) theCurve, double theParameter)
{
- return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, 1, PointOn_CurveByParam);
+ return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
}
//=============================================================================
double theYParam,
double theZParam)
{
- return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, 1, PointOn_CurveByCoord);
+ return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, PointOn_CurveByCoord);
}
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
(Handle(GEOM_Object) theCurve,
double theLength,
- int theDirection)
+ bool theReverse)
{
- return makePointOnGeom(theCurve, theLength, 0.0, 0.0, theDirection, PointOn_CurveByLength);
+ return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theReverse);
}
//=============================================================================
double theUParameter,
double theVParameter)
{
- return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., 1, PointOn_SurfaceByParam);
+ return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., PointOn_SurfaceByParam);
}
//=============================================================================
double theYParam,
double theZParam)
{
- return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, 1, PointOn_SurfaceByCoord);
+ return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
}
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve,
double theLength,
- int theDirection);
+ bool theReverse);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByCoord (Handle(GEOM_Object) theCurve,
double theXParam,
double theParam1,
double theParam2,
double theParam3,
- int theFlag1,
- const PointLocation theLocation);
+ const PointLocation theLocation,
+ bool theReverse = false);
};
#endif
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 SetFlag(int theFlag) { _func->SetInteger(ARG_FLAG, theFlag); }
+ void SetReversed(bool theReversed) { _func->SetInteger(ARG_FLAG, theReversed); }
double GetParameter() { return _func->GetReal(ARG_PARAM); }
double GetParameter2() { return _func->GetReal(ARG_PARAM2); }
double GetLength() { return _func->GetReal(ARG_LENGTH); }
- int GetFlag() { return _func->GetInteger(ARG_FLAG); }
+ bool GetReversed() { return _func->GetInteger(ARG_FLAG); }
private:
else if (aType == POINT_CURVE_LENGTH) {
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
Standard_Real theLength = aPI.GetLength();
- Standard_Integer theDirection = aPI.GetFlag();
+ Standard_Integer theReversed = aPI.GetReversed();
TopoDS_Shape aRefShape = aRefCurve->GetValue();
Standard_Real UFirst = 0;
Standard_Real ULast = 0;
}
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), UFirst, ULast);
Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
- if ( theDirection == 2 ) {
+ if ( theReversed ) {
ReOrientedCurve = EdgeCurve -> Reversed();
UFirst=ULast;
}
- else if ( theDirection != 0 ){
- Standard_TypeMismatch::Raise
- ("Point On Curve creation aborted : direction parameter must be 0 or 2");
- }
GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
GCPnts_AbscissaPoint anAbsPnt(AdapCurve, theLength, UFirst);
Standard_Real aParam = anAbsPnt.Parameter();
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByLength
(GEOM::GEOM_Object_ptr theCurve,
CORBA::Double theLength,
- CORBA::Double theDirection)
+ CORBA::Boolean theReverse)
{
GEOM::GEOM_Object_var aGEOMObject;
//Create the point
Handle(GEOM_Object) anObject =
GetOperations()->MakePointOnCurveByLength(aReference, theLength,
- theDirection);
+ theReverse);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
CORBA::Double theParameter);
GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theCurve,
- CORBA::Double theLength,
- CORBA::Double theDirection);
+ CORBA::Double theLength,
+ CORBA::Boolean theReverse);
GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theCurve,
CORBA::Double theXParameter,
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theLength,
- CORBA::Double theDirection)
+ CORBA::Boolean theReverse)
{
beginService( " GEOM_Superv_i::MakePointOnCurveByLength" );
MESSAGE("GEOM_Superv_i::MakePointOnCurveByLength");
getBasicOp();
- GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theDirection);
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theReverse);
endService( " GEOM_Superv_i::MakePointOnCurveByLength" );
return anObj;
}
CORBA::Double theParameter);
GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theLength,
- CORBA::Double theDirection);
+ CORBA::Boolean theReverse);
GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theXParameter,
CORBA::Double theYParameter,
#Test point on curve creation
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10 ) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
- p_on_arc3 = geompy.MakeVertexOnCurveByLength(Arc, 50, 2) #(GEOM_Object_ptr, Double, Double)->GEOM_Object_ptr
+ p_on_arc3 = geompy.MakeVertexOnCurveByLength(Arc, 50, True) #(GEOM_Object_ptr, Double, Boolean)->GEOM_Object_ptr
#Test point on lines intersection
p_on_l1l2 = geompy.MakeVertexOnLinesIntersection(Line1, Line2) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
## Create a point, corresponding to the given length on the given curve.
# @param theRefCurve The referenced curve.
# @param theLength Length on the referenced curve.
- # @param theDirection Flag allowing to choose the direction for the calculation of the length (0 = forward or 2 = reversed).
+ # @param theReverse Flag allowing to choose the direction for the calculation of the length (False = forward or True = reversed).
# @return New GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertexOnCurveByLength(self,theRefCurve, theLength, theDirection):
+ def MakeVertexOnCurveByLength(self,theRefCurve, theLength, theReverse = False):
# Example: see GEOM_TestAll.py
theLength, Parameters = ParseParameters(theLength)
- anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theDirection)
+ anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theReverse)
RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj