mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-06-30 12:14:08 +03:00
0024028: It is impossible to create a face based on Geom_RectangularTrimmedSurface by standard methods
1. Trimmed Surfaces were replaced with bases for *.igs and *.stp file format. BRepLib_MakeFace method sets the TRIMMED surface of Geom_RectangularTrimmedSurface in created face. 2. Adding test case for this fix
This commit is contained in:
parent
166d6cd76a
commit
9d109e39c2
@ -508,24 +508,23 @@ void BRepLib_MakeFace::Init(const Handle(Geom_Surface)& SS,
|
|||||||
|
|
||||||
Standard_Real umin,umax,vmin,vmax,T;
|
Standard_Real umin,umax,vmin,vmax,T;
|
||||||
|
|
||||||
Handle(Geom_Surface) S = SS;
|
Handle(Geom_Surface) S = SS, BS = SS;
|
||||||
Handle(Geom_RectangularTrimmedSurface) RS =
|
Handle(Geom_RectangularTrimmedSurface) RS =
|
||||||
Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
|
Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
|
||||||
if (!RS.IsNull())
|
if (!RS.IsNull())
|
||||||
S = RS->BasisSurface();
|
BS = RS->BasisSurface();
|
||||||
|
|
||||||
|
|
||||||
Standard_Boolean OffsetSurface =
|
Standard_Boolean OffsetSurface =
|
||||||
(S->DynamicType() == STANDARD_TYPE(Geom_OffsetSurface));
|
(BS->DynamicType() == STANDARD_TYPE(Geom_OffsetSurface));
|
||||||
|
|
||||||
// adjust periodical surface or reordonate
|
// adjust periodical surface or reordonate
|
||||||
// check if the values are in the natural range
|
// check if the values are in the natural range
|
||||||
Standard_Real epsilon = Precision::PConfusion();
|
Standard_Real epsilon = Precision::PConfusion();
|
||||||
|
|
||||||
S->Bounds(umin,umax,vmin,vmax);
|
BS->Bounds(umin,umax,vmin,vmax);
|
||||||
|
|
||||||
if (OffsetSurface) {
|
if (OffsetSurface) {
|
||||||
Handle(Geom_OffsetSurface) OS = Handle(Geom_OffsetSurface)::DownCast(S);
|
Handle(Geom_OffsetSurface) OS = Handle(Geom_OffsetSurface)::DownCast(BS);
|
||||||
Handle(Geom_Surface) Base = OS->BasisSurface();
|
Handle(Geom_Surface) Base = OS->BasisSurface();
|
||||||
|
|
||||||
if (Base->DynamicType() == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
|
if (Base->DynamicType() == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
|
||||||
|
@ -765,33 +765,50 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferSurfaceOfRevolution
|
|||||||
// (BRepPrimAPI_MakeRevol replace surface of revolution by plane then 3D and 2D curves are inconsistent;
|
// (BRepPrimAPI_MakeRevol replace surface of revolution by plane then 3D and 2D curves are inconsistent;
|
||||||
// and 3D is ignored. As result shape is rectangle instead circle shape.
|
// and 3D is ignored. As result shape is rectangle instead circle shape.
|
||||||
Handle(Geom_Curve) aBasisCurve;
|
Handle(Geom_Curve) aBasisCurve;
|
||||||
|
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
OCC_CATCH_SIGNALS
|
{
|
||||||
if (extractCurve3d(generatrix, aBasisCurve)) {
|
OCC_CATCH_SIGNALS
|
||||||
Handle(Geom_Surface) aResultSurf = new Geom_SurfaceOfRevolution(aBasisCurve, revolAxis);
|
if (extractCurve3d(generatrix, aBasisCurve))
|
||||||
if ( !aResultSurf.IsNull() && !IsFullAngle ) {
|
{
|
||||||
Standard_Real VF = aBasisCurve->FirstParameter();
|
BRepBuilderAPI_MakeFace aMakeF;
|
||||||
Standard_Real VL = aBasisCurve->LastParameter();
|
Handle(Geom_Surface) aResultSurf =
|
||||||
// PTV 29.08.2002 begin of OCC663 Trim surface by correct parameters
|
new Geom_SurfaceOfRevolution(aBasisCurve, revolAxis);
|
||||||
Standard_Real UF = 0;
|
|
||||||
Standard_Real UL = endAngle - startAngle;;
|
if ( !aResultSurf.IsNull())
|
||||||
//aResultSurf = new Geom_RectangularTrimmedSurface(aResultSurf, startAngle, endAngle, VF, VL);
|
{
|
||||||
aResultSurf = new Geom_RectangularTrimmedSurface(aResultSurf, UF, UL, VF, VL);
|
if (!IsFullAngle)
|
||||||
// PTV 29.08.2002 end of OCC663
|
{
|
||||||
}
|
const Standard_Real VF = aBasisCurve->FirstParameter();
|
||||||
if (!aResultSurf.IsNull()) {
|
const Standard_Real VL = aBasisCurve->LastParameter();
|
||||||
BRepBuilderAPI_MakeFace aMakeF(aResultSurf, Precision::Confusion());
|
|
||||||
if (aMakeF.IsDone()) res = aMakeF.Face();
|
// PTV 29.08.2002 begin of OCC663 Trim surface by correct parameters
|
||||||
}
|
const Standard_Real UF = 0;
|
||||||
|
const Standard_Real UL = endAngle - startAngle;
|
||||||
|
// PTV 29.08.2002 end of OCC663
|
||||||
|
|
||||||
|
aMakeF = BRepBuilderAPI_MakeFace(aResultSurf, UF,
|
||||||
|
UL, VF, VL, Precision::Confusion());
|
||||||
|
}//if (!IsFullAngle)
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aMakeF = BRepBuilderAPI_MakeFace(aResultSurf, Precision::Confusion());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aMakeF.IsDone())
|
||||||
|
res = aMakeF.Face();
|
||||||
|
}//if ( !aResultSurf.IsNull())
|
||||||
|
}//if (extractCurve3d(generatrix, aBasisCurve))
|
||||||
}
|
}
|
||||||
}
|
catch (Standard_Failure)
|
||||||
catch (Standard_Failure) {
|
{
|
||||||
#ifdef DEB
|
#ifdef DEB
|
||||||
cout << "Warning: IgesToBRep_TopoSurface::TransferSurfaceOfRevolution(): exception by Geom: ";
|
cout << "Warning: IgesToBRep_TopoSurface::"
|
||||||
Standard_Failure::Caught()->Print ( cout ); cout << endl;
|
"TransferSurfaceOfRevolution(): exception by Geom: ";
|
||||||
|
Standard_Failure::Caught()->Print ( cout ); cout << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}//catch (Standard_Failure)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( res.IsNull() ) {
|
if ( res.IsNull() ) {
|
||||||
@ -903,13 +920,17 @@ TopoDS_Shape IGESToBRep_TopoSurface::TransferTabulatedCylinder
|
|||||||
Handle(Geom_Surface) aResultSurf =
|
Handle(Geom_Surface) aResultSurf =
|
||||||
new Geom_SurfaceOfLinearExtrusion(aBasisCurve, dir);
|
new Geom_SurfaceOfLinearExtrusion(aBasisCurve, dir);
|
||||||
if (!aResultSurf.IsNull()) {
|
if (!aResultSurf.IsNull()) {
|
||||||
aResultSurf =
|
//aResultSurf =
|
||||||
new Geom_RectangularTrimmedSurface(aResultSurf,
|
// new Geom_RectangularTrimmedSurface(aResultSurf,
|
||||||
aBasisCurve->FirstParameter(),
|
// aBasisCurve->FirstParameter(),
|
||||||
|
// aBasisCurve->LastParameter(),
|
||||||
|
// 0., dir.Magnitude() );
|
||||||
|
BRepBuilderAPI_MakeFace aMakeF(aResultSurf, aBasisCurve->FirstParameter(),
|
||||||
aBasisCurve->LastParameter(),
|
aBasisCurve->LastParameter(),
|
||||||
0., dir.Magnitude() );
|
0., dir.Magnitude(),
|
||||||
BRepBuilderAPI_MakeFace aMakeF(aResultSurf, Precision::Confusion());
|
Precision::Confusion());
|
||||||
if (aMakeF.IsDone()) res = aMakeF.Face();
|
if (aMakeF.IsDone())
|
||||||
|
res = aMakeF.Face();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@
|
|||||||
#include <TopoDS_Compound.hxx>
|
#include <TopoDS_Compound.hxx>
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
|
|
||||||
|
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||||
|
|
||||||
#include <ShapeFix_ShapeTolerance.hxx>
|
#include <ShapeFix_ShapeTolerance.hxx>
|
||||||
#include <StepShape_ConnectedEdgeSet.hxx>
|
#include <StepShape_ConnectedEdgeSet.hxx>
|
||||||
#include <StepShape_EdgeBasedWireframeModel.hxx>
|
#include <StepShape_EdgeBasedWireframeModel.hxx>
|
||||||
@ -701,8 +703,24 @@ static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf,
|
|||||||
if (!StepToGeom_MakeSurface::Convert(surf,theSurf) || //:i6: protection
|
if (!StepToGeom_MakeSurface::Convert(surf,theSurf) || //:i6: protection
|
||||||
!theSurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) return res;
|
!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, TolDegen);
|
BRepBuilderAPI_MakeFace myMkFace;
|
||||||
|
|
||||||
|
Handle(Geom_RectangularTrimmedSurface) RS =
|
||||||
|
Handle(Geom_RectangularTrimmedSurface)::DownCast(theSurf);
|
||||||
|
|
||||||
|
if (!RS.IsNull())
|
||||||
|
{
|
||||||
|
Standard_Real umin, umax, vmin, vmax;
|
||||||
|
theSurf->Bounds(umin, umax, vmin, vmax);
|
||||||
|
|
||||||
|
myMkFace = BRepBuilderAPI_MakeFace(RS->BasisSurface(), umin, umax, vmin, vmax, TolDegen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myMkFace = BRepBuilderAPI_MakeFace(theSurf, TolDegen);
|
||||||
|
}
|
||||||
|
|
||||||
return myMkFace.Face();
|
return myMkFace.Face();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
tests/bugs/moddata_3/bug24028
Normal file
18
tests/bugs/moddata_3/bug24028
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
puts "================"
|
||||||
|
puts "CR24028"
|
||||||
|
puts "================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# It is impossible to create a face based on Geom_RectangularTrimmedSurface by standard methods
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
beziercurve cc 3 0 0 -10 1 20 0 0 10 0 0 10 1
|
||||||
|
revsurf ss cc 0 0 0 0 0 1
|
||||||
|
trimu ts ss 0 pi
|
||||||
|
|
||||||
|
mkface result ts
|
||||||
|
|
||||||
|
set square 1222.58
|
||||||
|
|
||||||
|
|
||||||
|
set 2dviewer 0
|
Loading…
x
Reference in New Issue
Block a user