Fix Drawing/TechDraw BSplines

In some cases the Geom_BSplineCurve returned by
BrepAdaptor_Curve.BSpline() does not have the
same endpoints as the original Edge and should
not be used in place of Approx_Curve3d.
This commit is contained in:
WandererFan
2017-06-27 20:53:42 -04:00
committed by wmayer
parent 18ed89ae6b
commit a32972ef2f
2 changed files with 61 additions and 68 deletions

View File

@@ -359,17 +359,18 @@ void SVGOutput::printBSpline(const BRepAdaptor_Curve& c, int id, std::ostream& o
{
try {
std::stringstream str;
Handle(Geom_BSplineCurve) spline = c.BSpline();
if (spline->Degree() > 3 || spline->IsRational()) {
Standard_Real tol3D = 0.001;
Standard_Integer maxDegree = 3, maxSegment = 100;
Handle(BRepAdaptor_HCurve) hCurve = new BRepAdaptor_HCurve(c);
// approximate the curve using a tolerance
Approx_Curve3d approx(hCurve,tol3D,GeomAbs_C0,maxSegment,maxDegree);
if (approx.IsDone() && approx.HasResult()) {
// have the result
spline = approx.Curve();
}
Handle(Geom_BSplineCurve) spline;
Standard_Real tol3D = 0.001;
Standard_Integer maxDegree = 3, maxSegment = 100;
Handle(BRepAdaptor_HCurve) hCurve = new BRepAdaptor_HCurve(c);
// approximate the curve using a tolerance
Approx_Curve3d approx(hCurve,tol3D,GeomAbs_C0,maxSegment,maxDegree);
if (approx.IsDone() && approx.HasResult()) {
// have the result
spline = approx.Curve();
} else {
printGeneric(c, id, out);
return;
}
GeomConvert_BSplineCurveToBezierCurve crt(spline);
@@ -659,17 +660,18 @@ void DXFOutput::printBSpline(const BRepAdaptor_Curve& c, int id, std::ostream& o
{
try {
std::stringstream str;
Handle(Geom_BSplineCurve) spline = c.BSpline();
if (spline->Degree() > 3 || spline->IsRational()) {
Standard_Real tol3D = 0.001;
Standard_Integer maxDegree = 3, maxSegment = 50;
Handle(BRepAdaptor_HCurve) hCurve = new BRepAdaptor_HCurve(c);
// approximate the curve using a tolerance
Approx_Curve3d approx(hCurve,tol3D,GeomAbs_C0,maxSegment,maxDegree);
if (approx.IsDone() && approx.HasResult()) {
// have the result
spline = approx.Curve();
}
Handle(Geom_BSplineCurve) spline;
Standard_Real tol3D = 0.001;
Standard_Integer maxDegree = 3, maxSegment = 50;
Handle(BRepAdaptor_HCurve) hCurve = new BRepAdaptor_HCurve(c);
// approximate the curve using a tolerance
Approx_Curve3d approx(hCurve,tol3D,GeomAbs_C0,maxSegment,maxDegree);
if (approx.IsDone() && approx.HasResult()) {
// have the result
spline = approx.Curve();
} else {
printGeneric(c, id, out);
return;
}
//GeomConvert_BSplineCurveToBezierCurve crt(spline);