The functionality to decide, whether the edge is degenerated, was shared via BRepLib_MakeFace. The verification of producing degenerated edges was added to BRepLib_MakeShell.
Test case for issue CR25591
Cone from gp,
Sphere from gp,
Torus from gp,
+ Curve from Geom,
Surface from Geom,
Face from TopoDS,
Wire from TopoDS,
NotDone from StdFail
is static;
+
+ IsDegenerated (myclass;
+ theCurve : Curve from Geom;
+ theMaxTol : Real from Standard;
+ theActTol : in out Real from Standard)
+ returns Boolean;
+ --- Purpose: Checks the specified curve is degenerated
+ -- according to specified tolerance.
+ -- Returns <theActTol> less than <theMaxTol>, which shows
+ -- actual tolerance to decide the curve is degenerated.
+ -- Warning: For internal use of BRepLib_MakeFace and BRepLib_MakeShell.
+
fields
myError : FaceError from BRepLib;
end MakeFace;
// passed tolerance value
//=======================================================================
-static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& theCurve,
- const Standard_Real theMaxTol,
- Standard_Real& theActTol)
+Standard_Boolean BRepLib_MakeFace::IsDegenerated(
+ const Handle(Geom_Curve)& theCurve,
+ const Standard_Real theMaxTol,
+ Standard_Real& theActTol)
{
GeomAdaptor_Curve AC(theCurve);
Standard_Real aConfusion = Precision::Confusion();
#include <BRepLib_MakeShell.ixx>
#include <BRepLib.hxx>
+#include <BRepLib_MakeFace.hxx>
#include <Precision.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TopTools_Array1OfShape.hxx>
#include <BRep_Builder.hxx>
+#include <TopExp_Explorer.hxx>
+
//=======================================================================
//function : BRepLib_MakeShell
BRepLib::BuildCurves3d(myShape,tol);
BRepLib::EncodeRegularity(myShape);
myShape.Closed (BRep_Tool::IsClosed (myShape));
+
+ // Additional checking for degenerated edges
+ Standard_Boolean isDegenerated;
+ Standard_Real aFirst, aLast;
+ Standard_Real aTol = Precision::Confusion();
+ Standard_Real anActTol;
+ TopExp_Explorer anExp(myShape, TopAbs_EDGE);
+ for ( ; anExp.More(); anExp.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(anExp.Current());
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
+ isDegenerated = BRepLib_MakeFace::IsDegenerated(aCurve, aTol, anActTol);
+ B.Degenerated(anEdge, isDegenerated);
+ }
myError = BRepLib_ShellDone;
Done();
--- /dev/null
+puts "============"
+puts "OCC25591"
+puts "============"
+puts ""
+#################################
+# Command mkshell produces wrong shell
+#################################
+
+sphere surf 100
+mkshell sh surf 1
+explode sh e
+catch {mkcurve csh_2 sh_2}
+
+if { [llength [dump csh_2]] > 0 } {
+ puts "Error: Command mkshell produces wrong shell"
+} else {
+ puts "OK: Command mkshell produces good shell"
+}