From: azv Date: Thu, 25 Dec 2014 13:42:49 +0000 (+0300) Subject: 0025591: Command mkshell produces wrong shell X-Git-Tag: V6_9_0_beta~221 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=b7d2387022691ba7466e72c45f06c10072099f4f;p=occt-copy.git 0025591: Command mkshell produces wrong shell 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 --- diff --git a/src/BRepLib/BRepLib_MakeFace.cdl b/src/BRepLib/BRepLib_MakeFace.cdl index 234413c97b..b93da765bb 100644 --- a/src/BRepLib/BRepLib_MakeFace.cdl +++ b/src/BRepLib/BRepLib_MakeFace.cdl @@ -48,6 +48,7 @@ uses Cone from gp, Sphere from gp, Torus from gp, + Curve from Geom, Surface from Geom, Face from TopoDS, Wire from TopoDS, @@ -258,6 +259,18 @@ is 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 less than , 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; diff --git a/src/BRepLib/BRepLib_MakeFace.cxx b/src/BRepLib/BRepLib_MakeFace.cxx index 5c39227731..82c86ae8fd 100644 --- a/src/BRepLib/BRepLib_MakeFace.cxx +++ b/src/BRepLib/BRepLib_MakeFace.cxx @@ -427,9 +427,10 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& S, // 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(); diff --git a/src/BRepLib/BRepLib_MakeShell.cxx b/src/BRepLib/BRepLib_MakeShell.cxx index 446f887b1d..b973335e5a 100644 --- a/src/BRepLib/BRepLib_MakeShell.cxx +++ b/src/BRepLib/BRepLib_MakeShell.cxx @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -35,6 +36,8 @@ #include #include +#include + //======================================================================= //function : BRepLib_MakeShell @@ -354,6 +357,20 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S, 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(); diff --git a/tests/bugs/modalg_5/bug25591 b/tests/bugs/modalg_5/bug25591 new file mode 100644 index 0000000000..b562eafb1f --- /dev/null +++ b/tests/bugs/modalg_5/bug25591 @@ -0,0 +1,18 @@ +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" +}