1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

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
This commit is contained in:
azv
2014-12-25 16:42:49 +03:00
committed by bugmaster
parent 656ec77a10
commit b7d2387022
4 changed files with 52 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ uses
Cone from gp, Cone from gp,
Sphere from gp, Sphere from gp,
Torus from gp, Torus from gp,
Curve from Geom,
Surface from Geom, Surface from Geom,
Face from TopoDS, Face from TopoDS,
Wire from TopoDS, Wire from TopoDS,
@@ -258,6 +259,18 @@ is
NotDone from StdFail NotDone from StdFail
is static; 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 fields
myError : FaceError from BRepLib; myError : FaceError from BRepLib;
end MakeFace; end MakeFace;

View File

@@ -427,7 +427,8 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& S,
// passed tolerance value // passed tolerance value
//======================================================================= //=======================================================================
static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& theCurve, Standard_Boolean BRepLib_MakeFace::IsDegenerated(
const Handle(Geom_Curve)& theCurve,
const Standard_Real theMaxTol, const Standard_Real theMaxTol,
Standard_Real& theActTol) Standard_Real& theActTol)
{ {

View File

@@ -17,6 +17,7 @@
#include <BRepLib_MakeShell.ixx> #include <BRepLib_MakeShell.ixx>
#include <BRepLib.hxx> #include <BRepLib.hxx>
#include <BRepLib_MakeFace.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TColStd_Array1OfReal.hxx> #include <TColStd_Array1OfReal.hxx>
@@ -35,6 +36,8 @@
#include <TopTools_Array1OfShape.hxx> #include <TopTools_Array1OfShape.hxx>
#include <BRep_Builder.hxx> #include <BRep_Builder.hxx>
#include <TopExp_Explorer.hxx>
//======================================================================= //=======================================================================
//function : BRepLib_MakeShell //function : BRepLib_MakeShell
@@ -355,6 +358,20 @@ void BRepLib_MakeShell::Init(const Handle(Geom_Surface)& S,
BRepLib::EncodeRegularity(myShape); BRepLib::EncodeRegularity(myShape);
myShape.Closed (BRep_Tool::IsClosed (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; myError = BRepLib_ShellDone;
Done(); Done();
} }

View File

@@ -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"
}