* 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).
* \return New GEOM_Object, containing the created point.
*/
GEOM_Object MakePointOnCurveByLength (in GEOM_Object theRefCurve,
- in double theLength);
-
+ in double theLength,
+ in double theDirection);
/*!
* Create a point on the given curve, projecting given point
GroupXYZ->TextLabel2->setText( tr( "GEOM_Y" ) );
GroupXYZ->TextLabel3->setText( tr( "GEOM_Z" ) );
- GroupOnCurve = new DlgRef_1Sel1Spin( centralWidget() );
+ GroupOnCurve = new DlgRef_1Sel1Spin1Check( centralWidget() );
GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_POINT_ON_EDGE" ) );
GroupOnCurve->TextLabel1->setText( tr( "GEOM_EDGE" ) );
GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) );
+ GroupOnCurve->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
GroupOnCurve->PushButton1->setIcon( image2 );
+
GroupOnSurface = new DlgRef_1Sel2Spin( centralWidget() );
GroupOnSurface->GroupBox1->setTitle( tr( "GEOM_POINT_ON_FACE" ) );
myNeedType = TopAbs_VERTEX;
myEditCurrentArgument = 0;
+ myCheckFlag = 0;
/* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
connect( GroupRefPoint->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupRefPoint->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( GroupOnCurve->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
+
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
displayPreview();
}
+//=================================================================================
+// function : CheckBoxClicked()
+// purpose : Check Boxes Management
+//=================================================================================
+void BasicGUI_PointDlg::CheckBoxClicked( int State )
+{
+ myCheckFlag = State;
+ displayPreview();
+}
+
+
//=================================================================================
// funcion : getParameter()
// purpose :
aParameters<<GroupOnCurve->SpinBox_DX->text();
}
else if ( myParamCoord->checkedId() == LENGTH_VALUE ) {
- anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter() );
+ anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), myCheckFlag );
+
+ std::stringstream out;
+ out<<myCheckFlag;
+ std::string flag = out.str();
aParameters<<GroupOnCurve->SpinBox_DX->text();
+ aParameters<<flag.c_str();
}
else if ( myParamCoord->checkedId() == COORD_VALUE ) {
double x = GroupXYZ->SpinBox_DX->value();
const int id = getConstructorId();
if ( id == GEOM_POINT_EDGE ) {
- GroupOnCurve->TextLabel2->setShown( isParam || isLength );
- GroupOnCurve->SpinBox_DX->setShown( isParam || isLength );
+ GroupOnCurve->TextLabel2->setVisible( isParam || isLength );
+ GroupOnCurve->SpinBox_DX->setVisible( isParam || isLength );
if ( isParam ){
initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision" );
GroupOnCurve->SpinBox_DX->setValue( 0.5 );
GroupOnCurve->TextLabel2->setText(tr( "GEOM_PARAMETER" ));
+ GroupOnCurve->CheckButton1->setVisible(false);
}
else if ( isLength ){
- initSpinBox( GroupOnCurve->SpinBox_DX, 0.0, COORD_MAX, 0.1 * step, "length_precision" );
+ initSpinBox( GroupOnCurve->SpinBox_DX, 0.0, COORD_MAX, step, "length_precision" );
GroupOnCurve->SpinBox_DX->setValue( 0.0 );
GroupOnCurve->TextLabel2->setText(tr( "GEOM_LENGTH" ));
+ GroupOnCurve->CheckButton1->setVisible(true);
}
}
else if ( id == GEOM_POINT_SURF ) {
#include <GEOMBase_Skeleton.h>
#include <QMap>
-class DlgRef_1Sel1Spin;
+class DlgRef_1Sel1Spin1Check;
class DlgRef_3Spin;
class DlgRef_2Sel;
class DlgRef_1Sel3Spin;
bool myBusy;
+ int myCheckFlag;
+
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
- DlgRef_1Sel1Spin* GroupOnCurve;
+ DlgRef_1Sel1Spin1Check* GroupOnCurve;
DlgRef_2Sel* GroupLineIntersection;
DlgRef_1Sel2Spin* GroupOnSurface;
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
void ClickParamCoord( int );
+ void CheckBoxClicked( int );
void onBtnPopup( QAction* );
void updateSize();
};
double theParam1,
double theParam2,
double theParam3,
+ int theFlag1,
const PointLocation theLocation)
{
SetErrorCode(KO);
break;
case PointOn_CurveByLength:
aPI.SetCurve(aRefFunction);
- aPI.SetLength(theParam1);
+ aPI.SetLength(theParam1);
+ aPI.SetFlag(theFlag1);
break;
case PointOn_CurveByCoord:
aPI.SetCurve(aRefFunction);
break;
case PointOn_CurveByLength:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
- << theGeomObj << ", " << theParam1 << ")";
+ << theGeomObj << ", " << theParam1 << ", " << theFlag1 << ")";
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, PointOn_CurveByParam);
+ return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, 1, PointOn_CurveByParam);
}
//=============================================================================
double theYParam,
double theZParam)
{
- return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, PointOn_CurveByCoord);
+ return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, 1, PointOn_CurveByCoord);
}
//=============================================================================
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
- (Handle(GEOM_Object) theCurve, double theLength)
+ (Handle(GEOM_Object) theCurve,
+ double theLength,
+ int theDirection)
{
- return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength);
+ return makePointOnGeom(theCurve, theLength, 0.0, 0.0, theDirection, PointOn_CurveByLength);
}
//=============================================================================
double theUParameter,
double theVParameter)
{
- return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., PointOn_SurfaceByParam);
+ return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., 1, PointOn_SurfaceByParam);
}
//=============================================================================
double theYParam,
double theZParam)
{
- return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
+ return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, 1, PointOn_SurfaceByCoord);
}
double theParameter);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve,
- double theLength);
+ double theLength,
+ int theDirection);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByCoord (Handle(GEOM_Object) theCurve,
double theXParam,
double theParam1,
double theParam2,
double theParam3,
+ int theFlag1,
const PointLocation theLocation);
};
#define ARG_LENGTH 11
+#define ARG_FLAG 12
+
class GEOMImpl_IPoint
{
public:
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); }
double GetParameter() { return _func->GetReal(ARG_PARAM); }
double GetParameter2() { return _func->GetReal(ARG_PARAM2); }
-
- void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); }
-
double GetLength() { return _func->GetReal(ARG_LENGTH); }
+ int GetFlag() { return _func->GetInteger(ARG_FLAG); }
private:
#include <BRep_Builder.hxx>
#include <Precision.hxx>
#include <TopAbs.hxx>
+//#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
+//#include <TopExp_Explorer.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <BRepAdaptor_Curve.hxx>
+#include <BRep_Tool.hxx>
+
//=======================================================================
//function : GetID
//purpose :
else if (aType == POINT_CURVE_LENGTH) {
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
Standard_Real theLength = aPI.GetLength();
+ Standard_Integer theDirection = aPI.GetFlag();
TopoDS_Shape aRefShape = aRefCurve->GetValue();
if (aRefShape.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
}
- BRepAdaptor_Curve AdapCurve = BRepAdaptor_Curve(TopoDS::Edge(aRefShape));
+ 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 )
+ ReOrientedCurve = EdgeCurve->Reversed();
+ else if ( theDirection == 0 )
+ ReOrientedCurve = EdgeCurve;
+ GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
Standard_Real theCurveLength = GCPnts_AbscissaPoint::Length(AdapCurve);
- //std::cout<<"theCurveLength = "<<theCurveLength<<std::endl;
if (theLength > theCurveLength) {
Standard_ConstructionError::Raise
("Point On Curve creation aborted : given length is greater than edges length");
}
-
- GCPnts_AbscissaPoint anAbsPnt(AdapCurve, aPI.GetLength(), 0);
+ GCPnts_AbscissaPoint anAbsPnt(AdapCurve, theLength, UFirst);
Standard_Real aParam = anAbsPnt.Parameter();
- Standard_Real result_length = GCPnts_AbscissaPoint::Length(AdapCurve, 0, aParam);
- std::cout<<"calculated Length of the result = "<<result_length<<std::endl;
aPnt = AdapCurve.Value(aParam);
}
else if (aType == POINT_SURFACE_PAR) {
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByLength
- (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theLength)
+ (GEOM::GEOM_Object_ptr theCurve,
+ CORBA::Double theLength,
+ CORBA::Double theDirection)
{
GEOM::GEOM_Object_var aGEOMObject;
//Create the point
Handle(GEOM_Object) anObject =
- GetOperations()->MakePointOnCurveByLength(aReference, theLength);
+ GetOperations()->MakePointOnCurveByLength(aReference, theLength,
+ theDirection);
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 theLength,
+ CORBA::Double theDirection);
GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theCurve,
CORBA::Double theXParameter,
// MakePointOnCurveByLength:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
- CORBA::Double theLength)
+ CORBA::Double theLength,
+ CORBA::Double theDirection)
{
beginService( " GEOM_Superv_i::MakePointOnCurveByLength" );
MESSAGE("GEOM_Superv_i::MakePointOnCurveByLength");
getBasicOp();
- GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength);
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theDirection);
endService( " GEOM_Superv_i::MakePointOnCurveByLength" );
return anObj;
}
GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theParameter);
GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
- CORBA::Double theLength);
+ CORBA::Double theLength,
+ CORBA::Double theDirection);
GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theXParameter,
CORBA::Double theYParameter,
## 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 theFirstParameter flag allowing to choose the direction for the calculation of the length (0 = forward or 2 = reversed).
# @return New GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertexOnCurveByLength(self,theRefCurve, theLength):
+ def MakeVertexOnCurveByLength(self,theRefCurve, theLength, theDirection):
# Example: see GEOM_TestAll.py
theLength, Parameters = ParseParameters(theLength)
- anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength)
+ anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theDirection)
RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj