mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
RNC: Corrected some Bugs related to the feature EDF 1542
This commit is contained in:
parent
9f5b7b1ffd
commit
bbebe02fd0
@ -31,15 +31,14 @@
|
|||||||
#include <BRepBuilderAPI_MakeVertex.hxx>
|
#include <BRepBuilderAPI_MakeVertex.hxx>
|
||||||
#include <BRepExtrema_DistShapeShape.hxx>
|
#include <BRepExtrema_DistShapeShape.hxx>
|
||||||
#include <BRep_Builder.hxx>
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <BRepAdaptor_Curve.hxx>
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
//#include <TopExp.hxx>
|
|
||||||
#include <TopoDS.hxx>
|
#include <TopoDS.hxx>
|
||||||
#include <TopoDS_Edge.hxx>
|
#include <TopoDS_Edge.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
//#include <TopExp_Explorer.hxx>
|
|
||||||
|
|
||||||
#include <Geom_Curve.hxx>
|
#include <Geom_Curve.hxx>
|
||||||
#include <Geom_Surface.hxx>
|
#include <Geom_Surface.hxx>
|
||||||
@ -48,9 +47,7 @@
|
|||||||
#include <ShapeAnalysis.hxx>
|
#include <ShapeAnalysis.hxx>
|
||||||
|
|
||||||
#include <GCPnts_AbscissaPoint.hxx>
|
#include <GCPnts_AbscissaPoint.hxx>
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
#include <IntTools.hxx>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetID
|
//function : GetID
|
||||||
@ -161,24 +158,28 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
|
|||||||
Standard_Real theLength = aPI.GetLength();
|
Standard_Real theLength = aPI.GetLength();
|
||||||
Standard_Integer theDirection = aPI.GetFlag();
|
Standard_Integer theDirection = aPI.GetFlag();
|
||||||
TopoDS_Shape aRefShape = aRefCurve->GetValue();
|
TopoDS_Shape aRefShape = aRefCurve->GetValue();
|
||||||
|
Standard_Real UFirst = 0;
|
||||||
|
Standard_Real ULast = 0;
|
||||||
if (aRefShape.ShapeType() != TopAbs_EDGE) {
|
if (aRefShape.ShapeType() != TopAbs_EDGE) {
|
||||||
Standard_TypeMismatch::Raise
|
Standard_TypeMismatch::Raise
|
||||||
("Point On Curve creation aborted : curve shape is not an edge");
|
("Point On Curve creation aborted : curve shape is not an edge");
|
||||||
}
|
}
|
||||||
Standard_Real UFirst = 0;
|
Standard_Real theCurveLength = IntTools::Length(TopoDS::Edge(aRefShape));
|
||||||
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);
|
|
||||||
if (theLength > theCurveLength) {
|
if (theLength > theCurveLength) {
|
||||||
Standard_ConstructionError::Raise
|
Standard_ConstructionError::Raise
|
||||||
("Point On Curve creation aborted : given length is greater than edges length");
|
("Point On Curve creation aborted : given length is greater than edges length");
|
||||||
}
|
}
|
||||||
|
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), UFirst, ULast);
|
||||||
|
Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
|
||||||
|
if ( theDirection == 2 ) {
|
||||||
|
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);
|
GCPnts_AbscissaPoint anAbsPnt(AdapCurve, theLength, UFirst);
|
||||||
Standard_Real aParam = anAbsPnt.Parameter();
|
Standard_Real aParam = anAbsPnt.Parameter();
|
||||||
aPnt = AdapCurve.Value(aParam);
|
aPnt = AdapCurve.Value(aParam);
|
||||||
|
Loading…
Reference in New Issue
Block a user