1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

...

8 Commits

Author SHA1 Message Date
aavtamon
5014de17b4 Fixed tolerance. 2021-01-14 09:08:31 +03:00
aavtamon
34c8a38852 Fixed Line creation. 2021-01-13 11:42:55 +03:00
aavtamon
ab17299a28 The line's condition and the parameters range are changed. 2021-01-11 21:38:44 +03:00
aavtamon
e24d2ddc6a This version doesn't have exceptions but still doesn't work correctly. 2020-12-29 09:41:28 +03:00
aavtamon
0e62be312d Location and tolerance was added. 2020-12-24 11:51:11 +03:00
aavtamon
dc05c4c0a7 A check of curve existence was added 2020-12-22 13:25:07 +03:00
aavtamon
9d251adde6 0031840: Modeling Algorithms - CRUnionface change seam edge from Line to BSplineCurve
ShapeBuild_Edge::BuildCurve3d(const TopoDS_Edge& edge) was modified to create Geom_Line instead of Geom_BSplineCurve for cylindical and conical surfaces,
if the PCurve on these surfaces is line and coincides with the V-direction.
2020-12-22 10:38:37 +03:00
aavtamon
2a52cc0ff9 Try to modify ShapeBuild_Edge 2020-12-21 10:25:12 +03:00

View File

@@ -32,9 +32,13 @@
#include <Geom2d_Line.hxx>
#include <Geom2d_OffsetCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dConvert.hxx>
#include <Geom2dConvert_ApproxCurve.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Line.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_OffsetCurve.hxx>
#include <Geom_Surface.hxx>
#include <Geom_TrimmedCurve.hxx>
@@ -600,6 +604,40 @@ Standard_Boolean ShapeBuild_Edge::BuildCurve3d (const TopoDS_Edge& edge) const
{
try {
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
//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