mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5014de17b4 | ||
|
34c8a38852 | ||
|
ab17299a28 | ||
|
e24d2ddc6a | ||
|
0e62be312d | ||
|
dc05c4c0a7 | ||
|
9d251adde6 | ||
|
2a52cc0ff9 |
@@ -32,9 +32,13 @@
|
|||||||
#include <Geom2d_Line.hxx>
|
#include <Geom2d_Line.hxx>
|
||||||
#include <Geom2d_OffsetCurve.hxx>
|
#include <Geom2d_OffsetCurve.hxx>
|
||||||
#include <Geom2d_TrimmedCurve.hxx>
|
#include <Geom2d_TrimmedCurve.hxx>
|
||||||
|
#include <Geom2dAdaptor_Curve.hxx>
|
||||||
#include <Geom2dConvert.hxx>
|
#include <Geom2dConvert.hxx>
|
||||||
#include <Geom2dConvert_ApproxCurve.hxx>
|
#include <Geom2dConvert_ApproxCurve.hxx>
|
||||||
#include <Geom_Curve.hxx>
|
#include <Geom_Curve.hxx>
|
||||||
|
#include <Geom_Line.hxx>
|
||||||
|
#include <Geom_ConicalSurface.hxx>
|
||||||
|
#include <Geom_CylindricalSurface.hxx>
|
||||||
#include <Geom_OffsetCurve.hxx>
|
#include <Geom_OffsetCurve.hxx>
|
||||||
#include <Geom_Surface.hxx>
|
#include <Geom_Surface.hxx>
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
#include <Geom_TrimmedCurve.hxx>
|
||||||
@@ -600,37 +604,71 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS
|
OCC_CATCH_SIGNALS
|
||||||
|
|
||||||
|
//The next piece of code has been added in order to fix bug31840
|
||||||
|
//Trying to create a straight line instead of bspline-curve if it's possible
|
||||||
|
//Start of the new code
|
||||||
|
Handle(Geom2d_Curve) anEdgeCurve;
|
||||||
|
Handle(Geom_Surface) anEdgeSurface;
|
||||||
|
TopLoc_Location aLocation;
|
||||||
|
Standard_Real aFirst, aLast;
|
||||||
|
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(edge, aLocation, aFirst, aLast);
|
||||||
|
if (!aCurve.IsNull())
|
||||||
|
return Standard_True;
|
||||||
|
BRep_Tool::CurveOnSurface(edge, anEdgeCurve, anEdgeSurface, aLocation, aFirst, aLast);
|
||||||
|
if (anEdgeCurve.IsNull() || anEdgeSurface.IsNull())
|
||||||
|
return Standard_False;
|
||||||
|
if ((anEdgeSurface->IsKind(STANDARD_TYPE(Geom_ConicalSurface)) ||
|
||||||
|
anEdgeSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) &&
|
||||||
|
anEdgeCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) {
|
||||||
|
gp_Pnt2d p1 = anEdgeCurve->Value(aFirst);
|
||||||
|
gp_Pnt2d p2 = anEdgeCurve->Value(aLast);
|
||||||
|
if (abs(p1.X() - p2.X()) <= Precision::Confusion() && abs(p1.Y() - p2.Y()) > Precision::Confusion()) {
|
||||||
|
gp_Pnt P1 = anEdgeSurface->Value(p1.X(), p1.Y());
|
||||||
|
gp_Pnt P2 = anEdgeSurface->Value(p2.X(), p2.Y());
|
||||||
|
gp_Vec aVec(P1, P2);
|
||||||
|
Handle(Geom_Line) aLine = new Geom_Line(gp_Ax1(P1, aVec));
|
||||||
|
gp_Pnt P0 = aLine->Value(-aFirst);
|
||||||
|
aLine->Translate(P1, P0);
|
||||||
|
Handle(Geom_TrimmedCurve) aNewCurve = new Geom_TrimmedCurve(aLine, aFirst, aLast);
|
||||||
|
BRep_Builder aBuilder;
|
||||||
|
Standard_Real aTol = Max(1.e-5, BRep_Tool::Tolerance(edge));
|
||||||
|
aBuilder.UpdateEdge(edge, aNewCurve, aLocation, aTol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//End of the new code
|
||||||
|
|
||||||
//#48 rln 10.12.98 S4054 UKI60107-5 entity 365
|
//#48 rln 10.12.98 S4054 UKI60107-5 entity 365
|
||||||
//C0 surface (but curve 3d is required as C1) and tolerance is 1e-07
|
//C0 surface (but curve 3d is required as C1) and tolerance is 1e-07
|
||||||
//lets use maximum of tolerance and default parameter 1.e-5
|
//lets use maximum of tolerance and default parameter 1.e-5
|
||||||
//Another solutions: use quite big Tolerance or require C0 curve on C0 surface
|
//Another solutions: use quite big Tolerance or require C0 curve on C0 surface
|
||||||
if ( BRepLib::BuildCurve3d (edge, Max (1.e-5, BRep_Tool::Tolerance(edge) ) ) ) {
|
if (BRepLib::BuildCurve3d(edge, Max(1.e-5, BRep_Tool::Tolerance(edge)))) {
|
||||||
//#50 S4054 rln 14.12.98 write cylinder in BRep mode into IGES and read back
|
//#50 S4054 rln 14.12.98 write cylinder in BRep mode into IGES and read back
|
||||||
//with 2DUse_Forced - pcurve and removed 3D curves have different ranges
|
//with 2DUse_Forced - pcurve and removed 3D curves have different ranges
|
||||||
if (BRep_Tool::SameRange (edge)) {
|
if (BRep_Tool::SameRange(edge)) {
|
||||||
Standard_Real first, last;
|
Standard_Real first, last;
|
||||||
BRep_Tool::Range (edge, first, last);
|
BRep_Tool::Range(edge, first, last);
|
||||||
BRep_Builder().Range (edge, first, last);//explicit setting for all reps
|
BRep_Builder().Range(edge, first, last);//explicit setting for all reps
|
||||||
}
|
}
|
||||||
Handle(Geom_Curve) c3d;
|
Handle(Geom_Curve) c3d;
|
||||||
Standard_Real f,l;
|
Standard_Real f, l;
|
||||||
c3d = BRep_Tool::Curve(edge,f,l);
|
c3d = BRep_Tool::Curve(edge, f, l);
|
||||||
if (c3d.IsNull())
|
if (c3d.IsNull())
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
// 15.11.2002 PTV OCC966
|
// 15.11.2002 PTV OCC966
|
||||||
if(!IsPeriodic(c3d)) {
|
if (!IsPeriodic(c3d)) {
|
||||||
Standard_Boolean isLess = Standard_False;
|
Standard_Boolean isLess = Standard_False;
|
||||||
if(f < c3d->FirstParameter()) {
|
if (f < c3d->FirstParameter()) {
|
||||||
isLess = Standard_True;
|
isLess = Standard_True;
|
||||||
f = c3d->FirstParameter();
|
f = c3d->FirstParameter();
|
||||||
}
|
}
|
||||||
if(l > c3d->LastParameter()) {
|
if (l > c3d->LastParameter()) {
|
||||||
isLess = Standard_True;
|
isLess = Standard_True;
|
||||||
l = c3d->LastParameter();
|
l = c3d->LastParameter();
|
||||||
}
|
}
|
||||||
if(isLess) {
|
if (isLess) {
|
||||||
SetRange3d(edge,f,l);
|
SetRange3d(edge, f, l);
|
||||||
BRep_Builder().SameRange(edge,Standard_False);
|
BRep_Builder().SameRange(edge, Standard_False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user