From 1c72dff6128a6bdbb677066dc911d84c86c2fd62 Mon Sep 17 00:00:00 2001 From: SSV <> Date: Tue, 20 Sep 2011 11:44:50 +0000 Subject: [PATCH] 0022492: Scaled sphere (Solid with BSplineSurface) is wrongly exported in STEP. --- src/AIS/AIS_AngleDimension.cxx | 4 +- src/BRepAlgo/BRepAlgo_Section.cxx | 2 +- src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx | 2 +- .../BRepBuilderAPI_MakeFace.cdl | 57 ++--- .../BRepBuilderAPI_MakeFace.cxx | 36 +-- src/BRepExtrema/BRepExtrema_DistanceSS.cxx | 2 +- src/BRepFeat/BRepFeat.cxx | 2 +- src/BRepFeat/BRepFeat_MakeDPrism.cxx | 2 +- src/BRepFeat/BRepFeat_MakePrism.cxx | 2 +- src/BRepFill/BRepFill_Draft.cxx | 2 +- src/BRepLib/BRepLib_MakeFace.cdl | 37 +-- src/BRepLib/BRepLib_MakeFace.cxx | 213 ++++++++++-------- src/BRepMAT2d/BRepMAT2d_Explorer.cxx | 2 +- src/BRepOffset/BRepOffset_MakeOffset.cxx | 2 +- src/BRepOffset/BRepOffset_Offset.cxx | 2 +- src/BRepOffset/BRepOffset_Tool.cxx | 2 +- src/BRepTest/BRepTest_CurveCommands.cxx | 4 +- src/BRepTest/BRepTest_FillingCommands.cxx | 2 +- src/BRepTest/BRepTest_SurfaceCommands.cxx | 5 +- src/BRepTest/BRepTest_SweepCommands.cxx | 2 +- src/ChFi3d/ChFi3d_Builder_2.cxx | 2 +- src/ChFi3d/ChFi3d_Builder_CnCrn.cxx | 2 +- src/IGESToBRep/IGESToBRep_TopoSurface.cxx | 8 +- src/QABUC/QABUC.cxx | 8 +- src/QAMitutoyoUS/QAMitutoyoUS.cxx | 6 +- src/QANIC/QANIC.cxx | 2 +- src/QARicardo/QARicardo.cxx | 8 +- src/QATelco/QATelco.cxx | 2 +- src/ShapeFix/ShapeFix_Face.cxx | 4 +- src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx | 4 +- src/StepToGeom/StepToGeom_MakeSurface.cxx | 3 +- src/StepToTopoDS/StepToTopoDS_Builder.cxx | 9 +- ...pToTopoDS_TranslateCurveBoundedSurface.cxx | 2 +- .../StepToTopoDS_TranslateFace.cxx | 13 +- .../TopOpeBRepBuild_FuseFace.cxx | 2 +- 35 files changed, 248 insertions(+), 209 deletions(-) diff --git a/src/AIS/AIS_AngleDimension.cxx b/src/AIS/AIS_AngleDimension.cxx index 33794528c5..d1bbd95dd9 100755 --- a/src/AIS/AIS_AngleDimension.cxx +++ b/src/AIS/AIS_AngleDimension.cxx @@ -574,7 +574,7 @@ void AIS_AngleDimension::ComputeConeAngle(const Handle(Prs3d_Presentation)& aPre if ( aType == STANDARD_TYPE(Geom_OffsetSurface) || Offset > 0.01 ) { //offset surface aOffsetSurf = new Geom_OffsetSurface (aSurf, Offset); aSurf = aOffsetSurf->Surface(); - BRepBuilderAPI_MakeFace mkFace(aSurf); + BRepBuilderAPI_MakeFace mkFace(aSurf, Precision::Confusion()); mkFace.Build(); if( !mkFace.IsDone() ) return; tmpSurf.Initialize( mkFace.Face() ); @@ -1910,7 +1910,7 @@ void AIS_AngleDimension::ComputeConeAngleSelection(const Handle(SelectMgr_Select if ( aType == STANDARD_TYPE(Geom_OffsetSurface) || Offset > 0.01 ) { //offset surface aOffsetSurf = new Geom_OffsetSurface (aSurf, Offset); aSurf = aOffsetSurf->Surface(); - BRepBuilderAPI_MakeFace mkFace(aSurf); + BRepBuilderAPI_MakeFace mkFace(aSurf, Precision::Confusion()); mkFace.Build(); if( !mkFace.IsDone() ) return; tmpSurf.Initialize( mkFace.Face() ); diff --git a/src/BRepAlgo/BRepAlgo_Section.cxx b/src/BRepAlgo/BRepAlgo_Section.cxx index 14e1d1f78d..7df7c1426b 100755 --- a/src/BRepAlgo/BRepAlgo_Section.cxx +++ b/src/BRepAlgo/BRepAlgo_Section.cxx @@ -380,6 +380,6 @@ static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& ); TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S) { GeomAbs_Shape c = S->Continuity(); - if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S); + if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S, Precision::Confusion()); else return BRepBuilderAPI_MakeShell(S); } diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx index a415c834dc..7fffe9031b 100755 --- a/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_Section.cxx @@ -36,7 +36,7 @@ static TopoDS_Shape MakeShape(const Handle(Geom_Surface)& S) { GeomAbs_Shape c = S->Continuity(); - if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S); + if (c >= GeomAbs_C2) return BRepBuilderAPI_MakeFace(S, Precision::Confusion()); else return BRepBuilderAPI_MakeShell(S); } diff --git a/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cdl b/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cdl index 5e54e04bf9..4fe6aa0583 100755 --- a/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cdl +++ b/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cdl @@ -90,9 +90,10 @@ is ---Level: Public returns MakeFace from BRepBuilderAPI; - Create(S : Surface from Geom) - ---Purpose: Make a face from a Surface. - ---Level: Public + Create(S : Surface from Geom; TolDegen : Real) + ---Purpose: Make a face from a Surface. Accepts tolerance value (TolDegen) + -- for resolution of degenerated edges. + ---Level: Public returns MakeFace from BRepBuilderAPI; ---------------------------------------------- @@ -124,9 +125,10 @@ is ---Level: Public returns MakeFace from BRepBuilderAPI; - Create(S : Surface from Geom; UMin, UMax, VMin, VMax : Real) - ---Purpose: Make a face from a Surface. - ---Level: Public + Create(S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real) + ---Purpose: Make a face from a Surface. Accepts tolerance value (TolDegen) + -- for resolution of degenerated edges. + ---Level: Public returns MakeFace from BRepBuilderAPI; ---------------------------------------------- @@ -243,26 +245,29 @@ is -- want to work on the geometries of the two faces independently. is static; - Init(me : in out; S : Surface from Geom; Bound : Boolean = Standard_True) - ---Purpose: Initializes (or reinitializes) the construction of a face on - -- the surface S. If Bound is true (the default value), a wire is - -- automatically created from the natural bounds of the - -- surface S and added to the face in order to bound it. If - -- Bound is false, no wire is added. This option is used - -- when real bounds are known. These will be added to - -- the face after this initialization, using the function Add. - is static; - - Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax : Real) - ---Purpose: Initializes (or reinitializes) the construction of a face on - -- the surface S, limited in the u parametric direction by - -- the two parameter values UMin and UMax and in the - -- v parametric direction by the two parameter values VMin and VMax. - -- Warning - -- Error returns: - -- - BRepBuilderAPI_ParametersOutOfRange - -- when the parameters given are outside the bounds of the - -- surface or the basis surface of a trimmed surface. + Init(me : in out; S : Surface from Geom; Bound : Boolean; TolDegen : Real) + ---Purpose: Initializes (or reinitializes) the construction of a face on + -- the surface S. If Bound is true, a wire is + -- automatically created from the natural bounds of the + -- surface S and added to the face in order to bound it. If + -- Bound is false, no wire is added. This option is used + -- when real bounds are known. These will be added to + -- the face after this initialization, using the function Add. + -- TolDegen parameter is used for resolution of degenerated edges + -- if calculation of natural bounds is turned on. + is static; + + Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real) + ---Purpose: Initializes (or reinitializes) the construction of a face on + -- the surface S, limited in the u parametric direction by + -- the two parameter values UMin and UMax and in the + -- v parametric direction by the two parameter values VMin and VMax. + -- Warning + -- Error returns: + -- - BRepBuilderAPI_ParametersOutOfRange + -- when the parameters given are outside the bounds of the + -- surface or the basis surface of a trimmed surface. + -- TolDegen parameter is used for resolution of degenerated edges. is static; Add(me : in out; W : Wire from TopoDS) diff --git a/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cxx b/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cxx index 17357c6e8d..e59aeab356 100755 --- a/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cxx +++ b/src/BRepBuilderAPI/BRepBuilderAPI_MakeFace.cxx @@ -112,8 +112,9 @@ BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Torus& T) //purpose : //======================================================================= -BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S) -: myMakeFace(S) +BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, + const Standard_Real TolDegen) +: myMakeFace(S, TolDegen) { if ( myMakeFace.IsDone()) { Done(); @@ -222,12 +223,13 @@ BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const gp_Torus& T, //purpose : //======================================================================= -BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax) -: myMakeFace(S,UMin,UMax,VMin,VMax) +BRepBuilderAPI_MakeFace::BRepBuilderAPI_MakeFace (const Handle(Geom_Surface)& S, + const Standard_Real UMin, + const Standard_Real UMax, + const Standard_Real VMin, + const Standard_Real VMax, + const Standard_Real TolDegen) +: myMakeFace (S, UMin, UMax, VMin, VMax, TolDegen) { if ( myMakeFace.IsDone()) { Done(); @@ -389,9 +391,10 @@ void BRepBuilderAPI_MakeFace::Init(const TopoDS_Face& F) //======================================================================= void BRepBuilderAPI_MakeFace::Init(const Handle(Geom_Surface)& S, - const Standard_Boolean Bound) + const Standard_Boolean Bound, + const Standard_Real TolDegen) { - myMakeFace.Init(S,Bound); + myMakeFace.Init(S, Bound, TolDegen); if ( myMakeFace.IsDone()) { Done(); myShape = myMakeFace.Shape(); @@ -404,13 +407,14 @@ void BRepBuilderAPI_MakeFace::Init(const Handle(Geom_Surface)& S, //purpose : //======================================================================= -void BRepBuilderAPI_MakeFace::Init(const Handle(Geom_Surface)& SS, - const Standard_Real Um, - const Standard_Real UM, - const Standard_Real Vm, - const Standard_Real VM) +void BRepBuilderAPI_MakeFace::Init (const Handle(Geom_Surface)& SS, + const Standard_Real Um, + const Standard_Real UM, + const Standard_Real Vm, + const Standard_Real VM, + const Standard_Real TolDegen) { - myMakeFace.Init(SS,Um,UM,Vm,VM); + myMakeFace.Init (SS, Um, UM, Vm, VM, TolDegen); if ( myMakeFace.IsDone()) { Done(); myShape = myMakeFace.Shape(); diff --git a/src/BRepExtrema/BRepExtrema_DistanceSS.cxx b/src/BRepExtrema/BRepExtrema_DistanceSS.cxx index 9e5b247a35..634ac5c375 100755 --- a/src/BRepExtrema/BRepExtrema_DistanceSS.cxx +++ b/src/BRepExtrema/BRepExtrema_DistanceSS.cxx @@ -369,7 +369,7 @@ static void TRIM_INFINIT_FACE(const TopoDS_Shape& S1, const TopoDS_Shape& S2, } Handle(Geom_Surface) result = new Geom_RectangularTrimmedSurface(pSurf, Umin, Umax, Vmin, Vmax); - aResFace = BRepBuilderAPI_MakeFace(result); + aResFace = BRepBuilderAPI_MakeFace(result, Precision::Confusion()); bIsInfinit = Standard_True; } diff --git a/src/BRepFeat/BRepFeat.cxx b/src/BRepFeat/BRepFeat.cxx index 7a3c474899..fbb9c68a58 100755 --- a/src/BRepFeat/BRepFeat.cxx +++ b/src/BRepFeat/BRepFeat.cxx @@ -522,7 +522,7 @@ void BRepFeat::FaceUntil(const TopoDS_Shape& Sbase, return; } - FUntil = BRepLib_MakeFace(str); + FUntil = BRepLib_MakeFace(str, Precision::Confusion()); } diff --git a/src/BRepFeat/BRepFeat_MakeDPrism.cxx b/src/BRepFeat/BRepFeat_MakeDPrism.cxx index 30b4ae9d63..8a77308c21 100755 --- a/src/BRepFeat/BRepFeat_MakeDPrism.cxx +++ b/src/BRepFeat/BRepFeat_MakeDPrism.cxx @@ -802,7 +802,7 @@ void BRepFeat_MakeDPrism::PerformFromEnd(const TopoDS_Shape& Until) S = Handle(Geom_RectangularTrimmedSurface):: DownCast(S)->BasisSurface(); } - BRepLib_MakeFace fac(S); + BRepLib_MakeFace fac(S, Precision::Confusion()); mySFrom = fac.Face(); Trf = TransformShapeFU(0); // FFrom = TopoDS::Face(mySFrom); diff --git a/src/BRepFeat/BRepFeat_MakePrism.cxx b/src/BRepFeat/BRepFeat_MakePrism.cxx index 5c3a92f5c6..3318eba5fd 100755 --- a/src/BRepFeat/BRepFeat_MakePrism.cxx +++ b/src/BRepFeat/BRepFeat_MakePrism.cxx @@ -839,7 +839,7 @@ void BRepFeat_MakePrism::PerformFromEnd(const TopoDS_Shape& Until) S = Handle(Geom_RectangularTrimmedSurface):: DownCast(S)->BasisSurface(); } - BRepLib_MakeFace fac(S); + BRepLib_MakeFace fac(S, Precision::Confusion()); mySFrom = fac.Face(); Trf = TransformShapeFU(0); FFrom = TopoDS::Face(mySFrom); diff --git a/src/BRepFill/BRepFill_Draft.cxx b/src/BRepFill/BRepFill_Draft.cxx index c837c824ba..eeb4740f62 100755 --- a/src/BRepFill/BRepFill_Draft.cxx +++ b/src/BRepFill/BRepFill_Draft.cxx @@ -552,7 +552,7 @@ static Standard_Boolean GoodOrientation(const Bnd_Box& B, // En attendant une utilisation des traces & retriction dans BRepFill_Sweep // On fait un Fuse. BRepLib_MakeFace MkF; - MkF.Init(Surf); + MkF.Init(Surf, Standard_True, Precision::Confusion()); Fuse(MkF.Face(), KeepOutSide); } } diff --git a/src/BRepLib/BRepLib_MakeFace.cdl b/src/BRepLib/BRepLib_MakeFace.cdl index c335e64690..1b6c8d4505 100755 --- a/src/BRepLib/BRepLib_MakeFace.cdl +++ b/src/BRepLib/BRepLib_MakeFace.cdl @@ -88,9 +88,10 @@ is ---Level: Public returns MakeFace from BRepLib; - Create(S : Surface from Geom) - ---Purpose: Make a face from a Surface. - ---Level: Public + Create(S : Surface from Geom; TolDegen : Real) + ---Purpose: Make a face from a Surface. Accepts tolerance value (TolDegen) + -- for resolution of degenerated edges. + ---Level: Public returns MakeFace from BRepLib; ---------------------------------------------- @@ -122,9 +123,11 @@ is ---Level: Public returns MakeFace from BRepLib; - Create(S : Surface from Geom; UMin, UMax, VMin, VMax : Real) - ---Purpose: Make a face from a Surface. - ---Level: Public + Create(S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real) + ---Purpose: Make a face from a Surface. Accepts min & max parameters + -- to construct the face's bounds. Also accepts tolerance value (TolDegen) + -- for resolution of degenerated edges. + ---Level: Public returns MakeFace from BRepLib; ---------------------------------------------- @@ -198,16 +201,19 @@ is ---Level: Public is static; - Init(me : in out; S : Surface from Geom; Bound : Boolean = Standard_True) - ---Purpose: Creates the face from the surface. If Bound is - -- True a wire is made from the natural bounds. - ---Level: Public + Init(me : in out; S : Surface from Geom; Bound : Boolean; TolDegen : Real) + ---Purpose: Creates the face from the surface. If Bound is + -- True a wire is made from the natural bounds. + -- Accepts tolerance value (TolDegen) for resolution + -- of degenerated edges. + ---Level: Public is static; - Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax : Real) - ---Purpose: Creates the face from the surface and the min-max - -- values. - ---Level: Public + Init(me : in out; S : Surface from Geom; UMin, UMax, VMin, VMax, TolDegen : Real) + ---Purpose: Creates the face from the surface and the min-max + -- values. Accepts tolerance value (TolDegen) for resolution + -- of degenerated edges. + ---Level: Public is static; Add(me : in out; W : Wire from TopoDS) @@ -244,6 +250,5 @@ is is static; fields - myError : FaceError from BRepLib; - + myError : FaceError from BRepLib; end MakeFace; diff --git a/src/BRepLib/BRepLib_MakeFace.cxx b/src/BRepLib/BRepLib_MakeFace.cxx index 5299b44dab..c454681219 100755 --- a/src/BRepLib/BRepLib_MakeFace.cxx +++ b/src/BRepLib/BRepLib_MakeFace.cxx @@ -68,7 +68,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Face& F) BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P) { Handle(Geom_Plane) GP = new Geom_Plane(P); - Init(GP); + Init(GP, Standard_True, Precision::Confusion()); } @@ -80,7 +80,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P) BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C) { Handle(Geom_CylindricalSurface) GC = new Geom_CylindricalSurface(C); - Init(GC); + Init(GC, Standard_True, Precision::Confusion()); } @@ -92,7 +92,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C) BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C) { Handle(Geom_ConicalSurface) GC = new Geom_ConicalSurface(C); - Init(GC); + Init(GC, Standard_True, Precision::Confusion()); } @@ -104,7 +104,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C) BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S) { Handle(Geom_SphericalSurface) GS = new Geom_SphericalSurface(S); - Init(GS); + Init(GS, Standard_True, Precision::Confusion()); } @@ -116,7 +116,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S) BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T) { Handle(Geom_ToroidalSurface) GT = new Geom_ToroidalSurface(T); - Init(GT); + Init(GT, Standard_True, Precision::Confusion()); } @@ -125,9 +125,10 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T) //purpose : //======================================================================= -BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S) +BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S, + const Standard_Real TolDegen) { - Init(S); + Init(S, Standard_True, TolDegen); } @@ -137,13 +138,13 @@ BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S) //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax) + const Standard_Real UMin, + const Standard_Real UMax, + const Standard_Real VMin, + const Standard_Real VMax) { Handle(Geom_Plane) GP = new Geom_Plane(P); - Init(GP,UMin,UMax,VMin,VMax); + Init(GP, UMin, UMax, VMin, VMax, Precision::Confusion()); } @@ -153,13 +154,13 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax) + const Standard_Real UMin, + const Standard_Real UMax, + const Standard_Real VMin, + const Standard_Real VMax) { Handle(Geom_CylindricalSurface) GC = new Geom_CylindricalSurface(C); - Init(GC,UMin,UMax,VMin,VMax); + Init(GC, UMin, UMax, VMin, VMax, Precision::Confusion()); } @@ -169,13 +170,13 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax) + const Standard_Real UMin, + const Standard_Real UMax, + const Standard_Real VMin, + const Standard_Real VMax) { Handle(Geom_ConicalSurface) GC = new Geom_ConicalSurface(C); - Init(GC,UMin,UMax,VMin,VMax); + Init(GC, UMin, UMax, VMin, VMax, Precision::Confusion()); } @@ -185,13 +186,13 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax) + const Standard_Real UMin, + const Standard_Real UMax, + const Standard_Real VMin, + const Standard_Real VMax) { Handle(Geom_SphericalSurface) GS = new Geom_SphericalSurface(S); - Init(GS,UMin,UMax,VMin,VMax); + Init(GS, UMin, UMax, VMin, VMax, Precision::Confusion()); } @@ -201,13 +202,13 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax) + const Standard_Real UMin, + const Standard_Real UMax, + const Standard_Real VMin, + const Standard_Real VMax) { Handle(Geom_ToroidalSurface) GT = new Geom_ToroidalSurface(T); - Init(GT,UMin,UMax,VMin,VMax); + Init(GT, UMin, UMax, VMin, VMax, Precision::Confusion()); } @@ -217,12 +218,13 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S, - const Standard_Real UMin, - const Standard_Real UMax, - const Standard_Real VMin, - const Standard_Real VMax) + const Standard_Real UMin, + const Standard_Real UMax, + const Standard_Real VMin, + const Standard_Real VMax, + const Standard_Real TolDegen) { - Init(S,UMin,UMax,VMin,VMax); + Init(S, UMin, UMax, VMin, VMax, TolDegen); } @@ -232,7 +234,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W, - const Standard_Boolean OnlyPlane) + const Standard_Boolean OnlyPlane) { // Find a surface through the wire @@ -263,11 +265,11 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P, - const TopoDS_Wire& W, - const Standard_Boolean Inside) + const TopoDS_Wire& W, + const Standard_Boolean Inside) { Handle(Geom_Plane) Pl = new Geom_Plane(P); - Init(Pl,Standard_False); + Init(Pl, Standard_False, Precision::Confusion()); Add(W); if (Inside) CheckInside(); } @@ -279,11 +281,11 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside) + const TopoDS_Wire& W, + const Standard_Boolean Inside) { Handle(Geom_CylindricalSurface) GC = new Geom_CylindricalSurface(C); - Init(GC,Standard_False); + Init(GC, Standard_False, Precision::Confusion()); Add(W); if (Inside) CheckInside(); } @@ -295,11 +297,11 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C, - const TopoDS_Wire& W, - const Standard_Boolean Inside) + const TopoDS_Wire& W, + const Standard_Boolean Inside) { Handle(Geom_ConicalSurface) GC = new Geom_ConicalSurface(C); - Init(GC,Standard_False); + Init(GC, Standard_False, Precision::Confusion()); Add(W); if (Inside) CheckInside(); } @@ -311,11 +313,11 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S, - const TopoDS_Wire& W, - const Standard_Boolean Inside) + const TopoDS_Wire& W, + const Standard_Boolean Inside) { Handle(Geom_SphericalSurface) GS = new Geom_SphericalSurface(S); - Init(GS,Standard_False); + Init(GS, Standard_False, Precision::Confusion()); Add(W); if (Inside) CheckInside(); } @@ -327,11 +329,11 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T, - const TopoDS_Wire& W, - const Standard_Boolean Inside) + const TopoDS_Wire& W, + const Standard_Boolean Inside) { Handle(Geom_ToroidalSurface) GT = new Geom_ToroidalSurface(T); - Init(GT,Standard_False); + Init(GT, Standard_False, Precision::Confusion()); Add(W); if (Inside) CheckInside(); } @@ -343,10 +345,10 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S, - const TopoDS_Wire& W, - const Standard_Boolean Inside) + const TopoDS_Wire& W, + const Standard_Boolean Inside) { - Init(S,Standard_False); + Init(S, Standard_False, Precision::Confusion()); Add(W); if (Inside) CheckInside(); } @@ -358,7 +360,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S, //======================================================================= BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Face& F, - const TopoDS_Wire& W) + const TopoDS_Wire& W) { Init(F); Add(W); @@ -389,13 +391,14 @@ void BRepLib_MakeFace::Init(const TopoDS_Face& F) //======================================================================= void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& S, - const Standard_Boolean Bound) + const Standard_Boolean Bound, + const Standard_Real TolDegen) { myError = BRepLib_FaceDone; if (Bound) { Standard_Real UMin,UMax,VMin,VMax; S->Bounds(UMin,UMax,VMin,VMax); - Init(S,UMin,UMax,VMin,VMax); + Init(S,UMin,UMax,VMin,VMax,TolDegen); } else { BRep_Builder B; @@ -408,44 +411,58 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& S, //======================================================================= //function : IsDegenerated -//purpose : fonction statique qui verifie qu'une courbe n'est pas reduite -// a un point, pour ainsi coder l'edge Degenere. +//purpose : Checks whether the passed curve is degenerated with the +// passed tolerance value //======================================================================= -static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& C, - const Standard_Real tol) +static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& theCurve, + const Standard_Real theMaxTol, + Standard_Real& theActTol) { - GeomAdaptor_Curve AC(C); - + GeomAdaptor_Curve AC(theCurve); + Standard_Real aConfusion = Precision::Confusion(); + theActTol = aConfusion; GeomAbs_CurveType Type = AC.GetType(); + if (Type == GeomAbs_Circle) { gp_Circ Circ = AC.Circle(); - return (Circ.Radius() < tol); + if ( Circ.Radius() > theMaxTol ) + return Standard_False; + theActTol = Max(Circ.Radius(), aConfusion); + return Standard_True; } else if (Type == GeomAbs_BSplineCurve) { Handle(Geom_BSplineCurve) BS = AC.BSpline(); Standard_Integer NbPoles = BS->NbPoles(); - Standard_Real tol2 = tol*tol; + Standard_Real aMaxPoleDist2 = 0.0, aMaxTol2 = theMaxTol*theMaxTol; gp_Pnt P1,P2; P1 = BS->Pole(1); for (Standard_Integer i = 2; i <= NbPoles; i++) { P2 = BS->Pole(i); - if (P1.SquareDistance(P2) > tol2) return Standard_False; -// P1 = P2; + Standard_Real aPoleDist2 = P1.SquareDistance(P2); + if (aPoleDist2 > aMaxTol2) + return Standard_False; + if (aPoleDist2 > aMaxPoleDist2) + aMaxPoleDist2 = aPoleDist2; } + theActTol = Max(1.000001*Sqrt(aMaxPoleDist2), aConfusion); return Standard_True; } else if (Type == GeomAbs_BezierCurve) { Handle(Geom_BezierCurve) BZ = AC.Bezier(); Standard_Integer NbPoles = BZ->NbPoles(); - Standard_Real tol2 = tol*tol; + Standard_Real aMaxPoleDist2 = 0.0, aMaxTol2 = theMaxTol*theMaxTol;; gp_Pnt P1,P2; P1 = BZ->Pole(1); for (Standard_Integer i = 2; i <= NbPoles; i++) { P2 = BZ->Pole(i); - if (P1.SquareDistance(P2) > tol2) return Standard_False; -// P1 = P2; + Standard_Real aPoleDist2 = P1.SquareDistance(P2); + if (aPoleDist2 > aMaxTol2) + return Standard_False; + if (aPoleDist2 > aMaxPoleDist2) + aMaxPoleDist2 = aPoleDist2; } + theActTol = Max(1.000001*Sqrt(aMaxPoleDist2), aConfusion); return Standard_True; } @@ -458,10 +475,11 @@ static Standard_Boolean IsDegenerated(const Handle(Geom_Curve)& C, //======================================================================= void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, - const Standard_Real Um, - const Standard_Real UM, - const Standard_Real Vm, - const Standard_Real VM) + const Standard_Real Um, + const Standard_Real UM, + const Standard_Real Vm, + const Standard_Real VM, + const Standard_Real TolDegen) { myError = BRepLib_FaceDone; @@ -549,26 +567,27 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, // compute 3d curves and degenerate flag - Standard_Real tol = Precision::Confusion(); + Standard_Real maxTol = TolDegen; Handle(Geom_Curve) Cumin,Cumax,Cvmin,Cvmax; Standard_Boolean Dumin,Dumax,Dvmin,Dvmax; Dumin = Dumax = Dvmin = Dvmax = Standard_False; + Standard_Real uminTol, umaxTol, vminTol, vmaxTol; if (!umininf) { Cumin = S->UIso(UMin); - Dumin = IsDegenerated(Cumin,tol); + Dumin = IsDegenerated(Cumin, maxTol, uminTol); } if (!umaxinf) { Cumax = S->UIso(UMax); - Dumax = IsDegenerated(Cumax,tol); + Dumax = IsDegenerated(Cumax, maxTol, umaxTol); } if (!vmininf) { Cvmin = S->VIso(VMin); - Dvmin = IsDegenerated(Cvmin,tol); + Dvmin = IsDegenerated(Cvmin, maxTol, vminTol); } if (!vmaxinf) { Cvmax = S->VIso(VMax); - Dvmax = IsDegenerated(Cvmax,tol); + Dvmax = IsDegenerated(Cvmax, maxTol, vmaxTol); } // compute vertices @@ -577,12 +596,12 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, TopoDS_Vertex V00,V10,V11,V01; if (!umininf) { - if (!vmininf) B.MakeVertex(V00,S->Value(UMin,VMin),tol); - if (!vmaxinf) B.MakeVertex(V01,S->Value(UMin,VMax),tol); + if (!vmininf) B.MakeVertex(V00,S->Value(UMin,VMin), Max(uminTol, vminTol)); + if (!vmaxinf) B.MakeVertex(V01,S->Value(UMin,VMax), Max(uminTol, vmaxTol)); } if (!umaxinf) { - if (!vmininf) B.MakeVertex(V10,S->Value(UMax,VMin),tol); - if (!vmaxinf) B.MakeVertex(V11,S->Value(UMax,VMax),tol); + if (!vmininf) B.MakeVertex(V10,S->Value(UMax,VMin), Max(umaxTol, vminTol)); + if (!vmaxinf) B.MakeVertex(V11,S->Value(UMax,VMax), Max(umaxTol, vmaxTol)); } if (uclosed) { @@ -613,20 +632,20 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, // make the face TopoDS_Face& F = TopoDS::Face(myShape); - B.MakeFace(F,S,tol); + B.MakeFace(F,S,Precision::Confusion()); // make the edges TopoDS_Edge eumin,eumax,evmin,evmax; if (!umininf) { if (!Dumin) - B.MakeEdge(eumin,Cumin,tol); + B.MakeEdge(eumin,Cumin,uminTol); else B.MakeEdge(eumin); if (uclosed) - B.UpdateEdge(eumin,Lumax,Lumin,F,tol); + B.UpdateEdge(eumin,Lumax,Lumin,F,Max(uminTol, umaxTol)); else - B.UpdateEdge(eumin,Lumin,F,tol); + B.UpdateEdge(eumin,Lumin,F,uminTol); B.Degenerated(eumin,Dumin); if (!vmininf) { V00.Orientation(TopAbs_FORWARD); @@ -644,10 +663,10 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, eumax = eumin; else { if (!Dumax) - B.MakeEdge(eumax,Cumax,tol); + B.MakeEdge(eumax,Cumax,umaxTol); else B.MakeEdge(eumax); - B.UpdateEdge(eumax,Lumax,F,tol); + B.UpdateEdge(eumax,Lumax,F,umaxTol); B.Degenerated(eumax,Dumax); if (!vmininf) { V10.Orientation(TopAbs_FORWARD); @@ -663,13 +682,13 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, if (!vmininf) { if (!Dvmin) - B.MakeEdge(evmin,Cvmin,tol); + B.MakeEdge(evmin,Cvmin,vminTol); else B.MakeEdge(evmin); if (vclosed) - B.UpdateEdge(evmin,Lvmin,Lvmax,F,tol); + B.UpdateEdge(evmin,Lvmin,Lvmax,F,Max(vminTol, vmaxTol)); else - B.UpdateEdge(evmin,Lvmin,F,tol); + B.UpdateEdge(evmin,Lvmin,F,vminTol); B.Degenerated(evmin,Dvmin); if (!umininf) { V00.Orientation(TopAbs_FORWARD); @@ -687,10 +706,10 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, evmax = evmin; else { if (!Dvmax) - B.MakeEdge(evmax,Cvmax,tol); + B.MakeEdge(evmax,Cvmax,vmaxTol); else B.MakeEdge(evmax); - B.UpdateEdge(evmax,Lvmax,F,tol); + B.UpdateEdge(evmax,Lvmax,F,vmaxTol); B.Degenerated(evmax,Dvmax); if (!umininf) { V01.Orientation(TopAbs_FORWARD); @@ -748,7 +767,7 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS, // Les Isos sont Approximees a Precision::Approximation() // et on code Precision::Confusion() dans l'arete. // ==> Un petit passage dans SamePrameter pour regler les tolerances. - BRepLib::SameParameter( F, tol, Standard_True); + BRepLib::SameParameter(F, Precision::Confusion(), Standard_True); } Done(); diff --git a/src/BRepMAT2d/BRepMAT2d_Explorer.cxx b/src/BRepMAT2d/BRepMAT2d_Explorer.cxx index ba6ed59361..6cefcd4071 100755 --- a/src/BRepMAT2d/BRepMAT2d_Explorer.cxx +++ b/src/BRepMAT2d/BRepMAT2d_Explorer.cxx @@ -71,7 +71,7 @@ void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace) TopExp_Explorer Exp (F,TopAbs_WIRE); // Modified by Sergey KHROMOV - Tue Nov 26 16:10:37 2002 Begin Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F); - TopoDS_Face aNewF = BRepBuilderAPI_MakeFace(aSurf); + TopoDS_Face aNewF = BRepBuilderAPI_MakeFace(aSurf, Precision::Confusion()); while (Exp.More()) { Add (TopoDS::Wire (Exp.Current()),F, aNewF); diff --git a/src/BRepOffset/BRepOffset_MakeOffset.cxx b/src/BRepOffset/BRepOffset_MakeOffset.cxx index 883bc137f1..437ad0a71e 100755 --- a/src/BRepOffset/BRepOffset_MakeOffset.cxx +++ b/src/BRepOffset/BRepOffset_MakeOffset.cxx @@ -2085,7 +2085,7 @@ void BRepOffset_MakeOffset::CorrectConicalFaces() { Vfirst = -PI/2.; Vlast = p2d1.Y(); } - TopoDS_Face NewSphericalFace = BRepLib_MakeFace(aSphSurf, Ufirst, Ulast, Vfirst, Vlast); + TopoDS_Face NewSphericalFace = BRepLib_MakeFace(aSphSurf, Ufirst, Ulast, Vfirst, Vlast, Precision::Confusion()); TopoDS_Edge OldEdge; for (Explo.Init(NewSphericalFace, TopAbs_EDGE); Explo.More(); Explo.Next()) { diff --git a/src/BRepOffset/BRepOffset_Offset.cxx b/src/BRepOffset/BRepOffset_Offset.cxx index b14493736b..9152386373 100755 --- a/src/BRepOffset/BRepOffset_Offset.cxx +++ b/src/BRepOffset/BRepOffset_Offset.cxx @@ -1446,7 +1446,7 @@ void BRepOffset_Offset::Init(const TopoDS_Edge& Edge, GeomFill_Pipe Pipe(CP,myOffset); Pipe.Perform(); - BRepLib_MakeFace MF(Pipe.Surface()); + BRepLib_MakeFace MF(Pipe.Surface(), Precision::Confusion()); myFace = MF.Face(); if ( Offset < 0.) myFace.Reverse(); diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx index aab1bb19a7..e94d7b0f67 100755 --- a/src/BRepOffset/BRepOffset_Tool.cxx +++ b/src/BRepOffset/BRepOffset_Tool.cxx @@ -377,7 +377,7 @@ static void BuildPCurves (const TopoDS_Edge& E, { gp_Pnt fpoint = AC.Value( AC.FirstParameter() ); gp_Pnt lpoint = AC.Value( AC.LastParameter() ); - TopoDS_Face theFace = BRepLib_MakeFace( theSurf ); + TopoDS_Face theFace = BRepLib_MakeFace( theSurf, Precision::Confusion() ); Standard_Real U1 = 0., U2 = 0., TolProj = 1.e-4; //1.e-5; TopoDS_Edge theEdge; TopExp_Explorer Explo; diff --git a/src/BRepTest/BRepTest_CurveCommands.cxx b/src/BRepTest/BRepTest_CurveCommands.cxx index 3315522ee1..d7f441f458 100755 --- a/src/BRepTest/BRepTest_CurveCommands.cxx +++ b/src/BRepTest/BRepTest_CurveCommands.cxx @@ -862,7 +862,7 @@ static Standard_Integer profile(Draw_Interpretor& di, S = BRepBuilderAPI_MakeFace(P,MW.Wire()); else { BRepBuilderAPI_MakeFace MFace; - MFace.Init(Surface,Standard_False); + MFace.Init(Surface,Standard_False,Precision::Confusion()); MFace.Add(MW.Wire()); S = MFace.Face(); } @@ -1106,7 +1106,7 @@ static Standard_Integer bsplineprof(Draw_Interpretor& di, S = BRepBuilderAPI_MakeFace(P,MW.Wire()); else { BRepBuilderAPI_MakeFace MFace; - MFace.Init(Surface,Standard_False); + MFace.Init(Surface,Standard_False,Precision::Confusion()); MFace.Add(MW.Wire()); S = MFace.Face(); } diff --git a/src/BRepTest/BRepTest_FillingCommands.cxx b/src/BRepTest/BRepTest_FillingCommands.cxx index d12878f2fd..081a08262d 100755 --- a/src/BRepTest/BRepTest_FillingCommands.cxx +++ b/src/BRepTest/BRepTest_FillingCommands.cxx @@ -314,7 +314,7 @@ static Standard_Integer gplate (Draw_Interpretor & ,Standard_Integer n,const cha Henri.Surface()->Bounds( Umin, Umax, Vmin, Vmax); - BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax); + BRepBuilderAPI_MakeFace MF(Surf, Umin, Umax, Vmin, Vmax, Precision::Confusion()); DBRep::Set(a[1],MF.Face()); return 0; diff --git a/src/BRepTest/BRepTest_SurfaceCommands.cxx b/src/BRepTest/BRepTest_SurfaceCommands.cxx index 91d91a836f..04868d3c48 100755 --- a/src/BRepTest/BRepTest_SurfaceCommands.cxx +++ b/src/BRepTest/BRepTest_SurfaceCommands.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef WNT //#define strcasecmp strcmp Already defined @@ -78,7 +79,7 @@ static Standard_Integer mkface(Draw_Interpretor& , Standard_Integer n, const cha if (n == 3) { if (mkface) - res = BRepBuilderAPI_MakeFace(S); + res = BRepBuilderAPI_MakeFace(S, Precision::Confusion()); else res = BRepBuilderAPI_MakeShell(S,Segment); } @@ -91,7 +92,7 @@ static Standard_Integer mkface(Draw_Interpretor& , Standard_Integer n, const cha } else { if (mkface) - res = BRepBuilderAPI_MakeFace(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6])); + res = BRepBuilderAPI_MakeFace(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]),Precision::Confusion()); else res = BRepBuilderAPI_MakeShell(S,atof(a[3]),atof(a[4]),atof(a[5]),atof(a[6]), Segment); diff --git a/src/BRepTest/BRepTest_SweepCommands.cxx b/src/BRepTest/BRepTest_SweepCommands.cxx index d07a40c1f7..9b657e4f5e 100755 --- a/src/BRepTest/BRepTest_SweepCommands.cxx +++ b/src/BRepTest/BRepTest_SweepCommands.cxx @@ -166,7 +166,7 @@ static Standard_Integer geompipe(Draw_Interpretor& , Handle(Geom_Surface) Sur=aPipe.Surface(); TopoDS_Face F; if(!Sur.IsNull()) - F =BRepBuilderAPI_MakeFace(Sur); + F = BRepBuilderAPI_MakeFace(Sur, Precision::Confusion()); DBRep::Set(a[1],F); return 0; } diff --git a/src/ChFi3d/ChFi3d_Builder_2.cxx b/src/ChFi3d/ChFi3d_Builder_2.cxx index 17e9a2408a..636a2843fb 100755 --- a/src/ChFi3d/ChFi3d_Builder_2.cxx +++ b/src/ChFi3d/ChFi3d_Builder_2.cxx @@ -997,7 +997,7 @@ static void ChFi3d_BuildPlane (TopOpeBRepDS_DataStructure& DStr, if (theProp.IsNormalDefined()) { P = theProp.Value(); Handle(Geom_Plane) Pln = new Geom_Plane(P, theProp.Normal()); - TopoDS_Face NewF = BRepLib_MakeFace(Pln); + TopoDS_Face NewF = BRepLib_MakeFace(Pln, Precision::Confusion()); NewF.Orientation(F.Orientation()); pons.SetCoord(0.,0.); HS->ChangeSurface().Initialize(NewF); diff --git a/src/ChFi3d/ChFi3d_Builder_CnCrn.cxx b/src/ChFi3d/ChFi3d_Builder_CnCrn.cxx index 2a05ab589f..70dd7385c6 100755 --- a/src/ChFi3d/ChFi3d_Builder_CnCrn.cxx +++ b/src/ChFi3d/ChFi3d_Builder_CnCrn.cxx @@ -367,7 +367,7 @@ static void CurveHermite (const TopOpeBRepDS_DataStructure& DStr, TopExp::MapShapes(OrtProj.Projection() , TopAbs_EDGE, MapE1); if (MapE1.Extent()!=0){ if (MapE1.Extent()!=1) { - BRepLib_MakeFace Bface (BRep_Tool::Surface(F)); + BRepLib_MakeFace Bface (BRep_Tool::Surface(F), Precision::Confusion()); F=Bface.Face(); OrtProj.Init(F); OrtProj.Build(); diff --git a/src/IGESToBRep/IGESToBRep_TopoSurface.cxx b/src/IGESToBRep/IGESToBRep_TopoSurface.cxx index 06bd43cfca..647953f4aa 100755 --- a/src/IGESToBRep/IGESToBRep_TopoSurface.cxx +++ b/src/IGESToBRep/IGESToBRep_TopoSurface.cxx @@ -316,7 +316,7 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferTopoBasicSurface res = plane; } else { - BRepLib_MakeFace makeFace(surf); + BRepLib_MakeFace makeFace(surf, Precision::Confusion()); res = makeFace.Face(); } @@ -765,7 +765,7 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferSurfaceOfRevolution // PTV 29.08.2002 end of OCC663 } if (!aResultSurf.IsNull()) { - BRepBuilderAPI_MakeFace aMakeF(aResultSurf); + BRepBuilderAPI_MakeFace aMakeF(aResultSurf, Precision::Confusion()); if (aMakeF.IsDone()) res = aMakeF.Face(); } } @@ -902,7 +902,7 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferTabulatedCylinder aBasisCurve->FirstParameter(), aBasisCurve->LastParameter(), 0., dir.Magnitude() ); - BRepBuilderAPI_MakeFace aMakeF(aResultSurf); + BRepBuilderAPI_MakeFace aMakeF(aResultSurf, Precision::Confusion()); if (aMakeF.IsDone()) res = aMakeF.Face(); } } @@ -1089,7 +1089,7 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferOffsetSurface basisSrf = new Geom_OffsetSurface(geomSupport, st->Distance()*GetUnitFactor()); } - BRepLib_MakeFace MF(basisSrf); + BRepLib_MakeFace MF(basisSrf, Precision::Confusion()); if(!MF.IsDone()) { Message_Msg msg1265("IGES_1265"); SendFail(st, msg1265); // OffsetSurface Construction Error. diff --git a/src/QABUC/QABUC.cxx b/src/QABUC/QABUC.cxx index e9ca17a8da..c5362a0ba0 100755 --- a/src/QABUC/QABUC.cxx +++ b/src/QABUC/QABUC.cxx @@ -1161,7 +1161,7 @@ static Standard_Integer BUC60811(Draw_Interpretor& di, Standard_Integer argc, co array1.SetValue(3,2,gp_Pnt(200,300,0)); array1.SetValue(3,3,gp_Pnt(400,300,0)); BZ1 = new Geom_BezierSurface(array1); - BRepBuilderAPI_MakeFace bzf1( BZ1 ); + BRepBuilderAPI_MakeFace bzf1( BZ1, Precision::Confusion() ); TopoDS_Face F1= bzf1.Face(); ais1 = new AIS_Shape(F1); DBRep::Set("F1",F1); @@ -1209,7 +1209,7 @@ static Standard_Integer BUC60811(Draw_Interpretor& di, Standard_Integer argc, co //step 2. offseting the surface. Handle_Geom_OffsetSurface offsurf; offsurf = new Geom_OffsetSurface(BZ1, -100); - BRepBuilderAPI_MakeFace bzf2( offsurf ); + BRepBuilderAPI_MakeFace bzf2( offsurf, Precision::Confusion() ); TopoDS_Face F2= bzf2.Face(); Handle_AIS_Shape ais22 = new AIS_Shape(F2); aContext->Display(ais22); @@ -1375,13 +1375,13 @@ static Standard_Integer BUC60856(Draw_Interpretor& di, Standard_Integer /*argc*/ P1(0,0,20), P2(0,0,45); angle = 2*PI; Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value(); - TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S).Shape(); + TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape(); Handle(AIS_Shape) ais1 = new AIS_Shape(myshape); aContext->Display(ais1); aContext->SetColor(ais1, Quantity_NOC_BLUE1); Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2,R1, 0).Value(); - TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2).Shape(); + TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape(); Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2); aContext->Display(ais2); aContext->SetColor(ais2, Quantity_NOC_RED); diff --git a/src/QAMitutoyoUS/QAMitutoyoUS.cxx b/src/QAMitutoyoUS/QAMitutoyoUS.cxx index ca20b00ea8..b8d54e4598 100755 --- a/src/QAMitutoyoUS/QAMitutoyoUS.cxx +++ b/src/QAMitutoyoUS/QAMitutoyoUS.cxx @@ -34,21 +34,21 @@ static Standard_Integer BUC60857 (Draw_Interpretor& di, Standard_Integer /*argc* } Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value(); - TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S).Shape(); + TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape(); DBRep::Set("BUC60857_BLUE",myshape); Handle(AIS_Shape) ais1 = new AIS_Shape(myshape); aContext->Display(ais1); aContext->SetColor(ais1, Quantity_NOC_BLUE1); Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2, R1, 0).Value(); - TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2).Shape(); + TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape(); DBRep::Set("BUC60857_RED",myshape2); Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2); aContext->Display(ais2); aContext->SetColor(ais2, Quantity_NOC_RED); Handle(Geom_RectangularTrimmedSurface) S3 = GC_MakeTrimmedCone (P1, P2, R2, R1).Value(); - TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3).Shape(); + TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3, Precision::Confusion()).Shape(); DBRep::Set("BUC60857_GREEN",myshape3); Handle(AIS_Shape) ais3 = new AIS_Shape(myshape3); aContext->Display(ais3); diff --git a/src/QANIC/QANIC.cxx b/src/QANIC/QANIC.cxx index 63a4e640c7..0a9146e9e5 100755 --- a/src/QANIC/QANIC.cxx +++ b/src/QANIC/QANIC.cxx @@ -766,7 +766,7 @@ static Standard_Integer OCC825 (Draw_Interpretor& di,Standard_Integer argc, cons Handle(Geom_BezierSurface) BezSurf = new Geom_BezierSurface(poles); Handle(Geom_BSplineSurface) BSpSurf = GeomConvert::SurfaceToBSplineSurface(BezSurf); - BRepBuilderAPI_MakeFace faceMaker(BSpSurf); + BRepBuilderAPI_MakeFace faceMaker(BSpSurf, Precision::Confusion()); TopoDS_Face face = faceMaker.Face(); gp_Pnt pnt(0, size, 0); diff --git a/src/QARicardo/QARicardo.cxx b/src/QARicardo/QARicardo.cxx index d9d130e05e..efc986392a 100755 --- a/src/QARicardo/QARicardo.cxx +++ b/src/QARicardo/QARicardo.cxx @@ -235,7 +235,7 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, // Make face for first opening Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane); - mkFace.Init(Plane1,Standard_False); + mkFace.Init(Plane1,Standard_False,Precision::Confusion()); // SUPPORT: // - Use wires created by MakePipeShell //mkFace.Add(TopoDS::Wire(outerWire1_)); @@ -247,7 +247,7 @@ static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, // Make face for second opening Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane); - mkFace.Init(Plane2,Standard_False); + mkFace.Init(Plane2,Standard_False,Precision::Confusion()); // SUPPORT: // - Use wires created by MakePipeShell //mkFace.Add(TopoDS::Wire(outerWire2_)); @@ -606,7 +606,7 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con // Make face for first opening Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane); - mkFace.Init(Plane1,Standard_False); + mkFace.Init(Plane1,Standard_False,Precision::Confusion()); mkFace.Add(TopoDS::Wire(outerWire1_)); mkFace.Add(TopoDS::Wire(Wire1_.Reversed())); if (!mkFace.IsDone()) return TCL_ERROR; @@ -614,7 +614,7 @@ static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, con // Make face for second opening Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane); - mkFace.Init(Plane2,Standard_False); + mkFace.Init(Plane2,Standard_False,Precision::Confusion()); mkFace.Add(TopoDS::Wire(outerWire2_)); mkFace.Add(TopoDS::Wire(Wire2_.Reversed())); if (!mkFace.IsDone()) return TCL_ERROR; diff --git a/src/QATelco/QATelco.cxx b/src/QATelco/QATelco.cxx index 1f0f305a5a..0e7f9dc9b0 100755 --- a/src/QATelco/QATelco.cxx +++ b/src/QATelco/QATelco.cxx @@ -1075,7 +1075,7 @@ static Standard_Integer OCC606 ( Draw_Interpretor& di, Standard_Integer n, const Handle(Geom_BSplineSurface) result_surf1 = b_surface1.BSplineSurface(); if (!result_surf1.IsNull()) { - BRepBuilderAPI_MakeFace b_face1(result_surf1); + BRepBuilderAPI_MakeFace b_face1(result_surf1, Precision::Confusion()); TopoDS_Face bsp_face1 = b_face1.Face(); DBRep::Set(a[1],bsp_face1); } diff --git a/src/ShapeFix/ShapeFix_Face.cxx b/src/ShapeFix/ShapeFix_Face.cxx index da31c5f502..e79f769244 100755 --- a/src/ShapeFix/ShapeFix_Face.cxx +++ b/src/ShapeFix/ShapeFix_Face.cxx @@ -764,7 +764,7 @@ Standard_Boolean ShapeFix_Face::FixAddNaturalBound() // deal with case of empty face: just create a new one by standard tool if ( ws.Length() <=0 ) { - BRepBuilderAPI_MakeFace mf (mySurf->Surface()); + BRepBuilderAPI_MakeFace mf (mySurf->Surface(), Precision::Confusion()); if ( ! Context().IsNull() ) Context()->Replace ( myFace, mf.Face() ); myFace = mf.Face(); @@ -859,7 +859,7 @@ Standard_Boolean ShapeFix_Face::FixAddNaturalBound() /* variant 2 */ TopLoc_Location L; Handle(Geom_Surface) surf = BRep_Tool::Surface ( myFace, L ); - BRepBuilderAPI_MakeFace mf (surf); + BRepBuilderAPI_MakeFace mf (surf, Precision::Confusion()); TopoDS_Face ftmp = mf.Face(); ftmp.Location ( L ); for (wi.Initialize (ftmp,Standard_False); wi.More(); wi.Next()) { diff --git a/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx b/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx index e2b543c8a7..aefcabd8a4 100755 --- a/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx +++ b/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx @@ -81,7 +81,7 @@ void ShapeUpgrade_WireDivide::Init(const TopoDS_Wire& W, { // if (ShapeUpgrade::Debug()) cout <<"ShapeUpgrade_WireDivide::Init with Wire, Surface "< #include #include +#include //============================================================================= // Creation d' une Surface de Geom a partir d' une Surface de Step @@ -71,7 +72,7 @@ Standard_Boolean StepToGeom_MakeSurface::Convert (const Handle(StepGeom_Surface) const Standard_Real anOffset = OS->Distance() * UnitsMethods::LengthFactor(); if (aBasisSurface->Continuity() == GeomAbs_C0) { - const BRepBuilderAPI_MakeFace aBFace(aBasisSurface); + const BRepBuilderAPI_MakeFace aBFace(aBasisSurface, Precision::Confusion()); if (aBFace.IsDone()) { const TopoDS_Shape aResult = ShapeAlgo::AlgoContainer()->C0ShapeToC1Shape(aBFace.Face(), Abs(anOffset)); diff --git a/src/StepToTopoDS/StepToTopoDS_Builder.cxx b/src/StepToTopoDS/StepToTopoDS_Builder.cxx index adc1678646..e9dfbd15dd 100755 --- a/src/StepToTopoDS/StepToTopoDS_Builder.cxx +++ b/src/StepToTopoDS/StepToTopoDS_Builder.cxx @@ -675,7 +675,8 @@ void StepToTopoDS_Builder::Init (const Handle(StepShape_FaceBasedSurfaceModel)& // ============================================================================ //:i6 abv 17 Sep 98: ProSTEP TR9 r0601-ct.stp: to be able read GS: GeometricCurveSet -> GeometricSet -static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf) +static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf, + const Standard_Real TolDegen) { TopoDS_Face res; @@ -684,7 +685,7 @@ static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf) !theSurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) return res; //gka 11.01.99 file PRO7755.stp entity #2018 surface #1895: error BRepLib_MakeFace func IsDegenerated - BRepBuilderAPI_MakeFace myMkFace(theSurf); + BRepBuilderAPI_MakeFace myMkFace(theSurf, TolDegen); return myMkFace.Face(); } @@ -790,13 +791,13 @@ void StepToTopoDS_Builder::Init for ( Standard_Integer ii=1; ii <= nbi; ii++ ) for ( Standard_Integer j=1; j <= nbj; j++ ) { Handle(StepGeom_SurfacePatch) patch = RCS->SegmentsValue ( ii, j ); - TopoDS_Face f = TranslateBoundedSurf ( patch->ParentSurface() ); + TopoDS_Face f = TranslateBoundedSurf (patch->ParentSurface(), preci); if ( ! f.IsNull() ) B.Add ( C, f ); } res = C; } // try other surfs - else res = TranslateBoundedSurf ( aSurf ); + else res = TranslateBoundedSurf (aSurf, preci); } else TP->AddWarning (ent," Entity is not a Curve, Point or Surface"); if ( ! res.IsNull() ) { diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx b/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx index 7561c9a8ff..72cf162521 100755 --- a/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx +++ b/src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx @@ -90,7 +90,7 @@ Standard_Boolean StepToTopoDS_TranslateCurveBoundedSurface::Init ( // add natural bound if implicit if ( CBS->ImplicitOuter() ) { if ( Surf->IsKind(STANDARD_TYPE(Geom_BoundedSurface)) ) { - BRepBuilderAPI_MakeFace mf (Surf); + BRepBuilderAPI_MakeFace mf (Surf, Precision::Confusion()); myFace = mf.Face(); } else TP->AddWarning ( CBS, "Cannot make natural bounds on infinite surface" ); diff --git a/src/StepToTopoDS/StepToTopoDS_TranslateFace.cxx b/src/StepToTopoDS/StepToTopoDS_TranslateFace.cxx index fc66e8fead..8187d4ccb1 100755 --- a/src/StepToTopoDS/StepToTopoDS_TranslateFace.cxx +++ b/src/StepToTopoDS/StepToTopoDS_TranslateFace.cxx @@ -229,11 +229,14 @@ void StepToTopoDS_TranslateFace::Init Handle(StepShape_VertexLoop) VL = Handle(StepShape_VertexLoop)::DownCast(Loop); // abv 10.07.00 pr1sy.stp: vertex_loop can be wrong; so just make natural bounds - if (GeomSurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) { - BRepBuilderAPI_MakeFace mf (GeomSurf); - for (TopoDS_Iterator it(mf); it.More(); it.Next() ) - B.Add ( F, it.Value() ); - continue; + if (GeomSurf->IsKind (STANDARD_TYPE(Geom_SphericalSurface)) || + GeomSurf->IsKind (STANDARD_TYPE(Geom_BSplineSurface)) ) + { + BRepBuilderAPI_MakeFace mf (GeomSurf, Precision()); + for (TopoDS_Iterator it(mf); it.More(); it.Next()) + B.Add (F, it.Value()); + + continue; } if (//GeomSurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) || diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx index 4ba9be6359..69700a5b1c 100755 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_FuseFace.cxx @@ -420,7 +420,7 @@ void TopOpeBRepBuild_FuseFace::PerformFace() S = Handle(Geom_RectangularTrimmedSurface):: DownCast(S)->BasisSurface(); } - BRepLib_MakeFace MF(S); + BRepLib_MakeFace MF(S, Precision::Confusion()); for(it2.Initialize(myFaceLW); it2.More(); it2.Next()) { const TopoDS_Wire& wir1 = TopoDS::Wire(it2.Value()); -- 2.20.1