mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0026406: BRepPrimAPI_MakeRevol crash when rotating Paraboloid face.
Test-case for issue #26406
This commit is contained in:
parent
bc479df6c7
commit
534beb0a8d
@ -43,7 +43,7 @@ BRepSweep_NumLinearRegularSweep::BRepSweep_NumLinearRegularSweep
|
|||||||
const TopoDS_Shape& aGenShape,
|
const TopoDS_Shape& aGenShape,
|
||||||
const Sweep_NumShape& aDirShape):
|
const Sweep_NumShape& aDirShape):
|
||||||
|
|
||||||
myBuilder(aBuilder),
|
myBuilder(aBuilder),
|
||||||
myGenShape(aGenShape),
|
myGenShape(aGenShape),
|
||||||
myDirWire(aDirShape),
|
myDirWire(aDirShape),
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@
|
|||||||
#include <GeomAdaptor_HCurve.hxx>
|
#include <GeomAdaptor_HCurve.hxx>
|
||||||
#include <Geom_TrimmedCurve.hxx>
|
#include <Geom_TrimmedCurve.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
static Standard_Real ComputeTolerance(TopoDS_Edge& E,
|
static Standard_Real ComputeTolerance(TopoDS_Edge& E,
|
||||||
const TopoDS_Face& F,
|
const TopoDS_Face& F,
|
||||||
const Handle(Geom2d_Curve)& C)
|
const Handle(Geom2d_Curve)& C)
|
||||||
@ -216,14 +218,26 @@ TopoDS_Shape BRepSweep_Rotation::MakeEmptyGeneratingEdge
|
|||||||
const Sweep_NumShape& aDirV)
|
const Sweep_NumShape& aDirV)
|
||||||
{
|
{
|
||||||
//call in case of construction with copy, or only when meridian touches myaxe.
|
//call in case of construction with copy, or only when meridian touches myaxe.
|
||||||
|
TopoDS_Edge E;
|
||||||
|
if(BRep_Tool::Degenerated(TopoDS::Edge(aGenE)))
|
||||||
|
{
|
||||||
|
myBuilder.Builder().MakeEdge(E);
|
||||||
|
myBuilder.Builder().UpdateEdge(E, BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
|
||||||
|
myBuilder.Builder().Degenerated(E, Standard_True);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Standard_Real First,Last;
|
Standard_Real First,Last;
|
||||||
TopLoc_Location Loc;
|
TopLoc_Location Loc;
|
||||||
Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast
|
Handle(Geom_Curve) C = Handle(Geom_Curve)::DownCast
|
||||||
(BRep_Tool::Curve(TopoDS::Edge(aGenE),Loc,First,Last)->Copy());
|
(BRep_Tool::Curve(TopoDS::Edge(aGenE),Loc,First,Last)->Copy());
|
||||||
|
if(!C.IsNull())
|
||||||
|
{
|
||||||
C->Transform(Loc.Transformation());
|
C->Transform(Loc.Transformation());
|
||||||
TopoDS_Edge E;
|
|
||||||
if(aDirV.Index() == 2) C->Transform(myLocation.Transformation());
|
if(aDirV.Index() == 2) C->Transform(myLocation.Transformation());
|
||||||
|
}
|
||||||
myBuilder.Builder().MakeEdge(E,C,BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
|
myBuilder.Builder().MakeEdge(E,C,BRep_Tool::Tolerance(TopoDS::Edge(aGenE)));
|
||||||
|
}
|
||||||
if (aDirV.Index() == 1 &&
|
if (aDirV.Index() == 1 &&
|
||||||
IsInvariant(aGenE) &&
|
IsInvariant(aGenE) &&
|
||||||
myDirShapeTool.NbShapes() == 3) {
|
myDirShapeTool.NbShapes() == 3) {
|
||||||
@ -718,6 +732,7 @@ Standard_Boolean BRepSweep_Rotation::GGDShapeIsToAdd
|
|||||||
const TopoDS_Shape& aSubGenS,
|
const TopoDS_Shape& aSubGenS,
|
||||||
const Sweep_NumShape& aDirS )const
|
const Sweep_NumShape& aDirS )const
|
||||||
{
|
{
|
||||||
|
Standard_Boolean aRes = Standard_True;
|
||||||
if (aNewShape.ShapeType()==TopAbs_FACE &&
|
if (aNewShape.ShapeType()==TopAbs_FACE &&
|
||||||
aNewSubShape.ShapeType()==TopAbs_EDGE &&
|
aNewSubShape.ShapeType()==TopAbs_EDGE &&
|
||||||
aGenS.ShapeType()==TopAbs_EDGE &&
|
aGenS.ShapeType()==TopAbs_EDGE &&
|
||||||
@ -729,11 +744,11 @@ Standard_Boolean BRepSweep_Rotation::GGDShapeIsToAdd
|
|||||||
return (!IsInvariant(aSubGenS));
|
return (!IsInvariant(aSubGenS));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return Standard_True;
|
return aRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return Standard_True;
|
return aRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,20 +845,33 @@ Standard_Boolean BRepSweep_Rotation::HasShape
|
|||||||
const Sweep_NumShape& aDirS)const
|
const Sweep_NumShape& aDirS)const
|
||||||
{
|
{
|
||||||
if(aDirS.Type()==TopAbs_EDGE&&
|
if(aDirS.Type()==TopAbs_EDGE&&
|
||||||
aGenS.ShapeType()==TopAbs_EDGE){
|
aGenS.ShapeType()==TopAbs_EDGE)
|
||||||
|
{
|
||||||
// Verify that the edge has entrails
|
// Verify that the edge has entrails
|
||||||
const TopoDS_Edge& anEdge = TopoDS::Edge(aGenS);
|
const TopoDS_Edge& anEdge = TopoDS::Edge(aGenS);
|
||||||
Standard_Boolean hasGeom = !BRep_Tool::Degenerated(anEdge);
|
//
|
||||||
if (hasGeom)
|
if(BRep_Tool::Degenerated(anEdge)) return Standard_False;
|
||||||
{ // The edge is not degenerated. Check if it has no curve
|
|
||||||
Standard_Real aPFirst, aPLast;
|
Standard_Real aPFirst, aPLast;
|
||||||
TopLoc_Location aLoc;
|
TopLoc_Location aLoc;
|
||||||
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, aPFirst, aPLast);
|
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aLoc, aPFirst, aPLast);
|
||||||
hasGeom = !aCurve.IsNull();
|
if(aCurve.IsNull()) return Standard_False;
|
||||||
|
|
||||||
|
if(IsInvariant(aGenS)) return Standard_False;
|
||||||
|
|
||||||
|
//Check seem edge
|
||||||
|
TopExp_Explorer FaceExp(myGenShape, TopAbs_FACE);
|
||||||
|
for (;FaceExp.More(); FaceExp.Next()) {
|
||||||
|
TopoDS_Face F = TopoDS::Face(FaceExp.Current());
|
||||||
|
if (BRepTools::IsReallyClosed(anEdge, F))
|
||||||
|
return Standard_False;
|
||||||
}
|
}
|
||||||
return hasGeom && !IsInvariant(aGenS);
|
|
||||||
|
return Standard_True;
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
tests/bugs/modalg_6/bug26406
Normal file
15
tests/bugs/modalg_6/bug26406
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC26406"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
#############################################################
|
||||||
|
# BRepPrimAPI_MakeRevol crash when rotating Paraboloid face
|
||||||
|
#############################################################
|
||||||
|
|
||||||
|
smallview
|
||||||
|
|
||||||
|
restore [locate_data_file OCC26406-Paraboloid.brep] p
|
||||||
|
revol r p 0 0 0 0 0 1 180 c
|
||||||
|
checkshape r
|
||||||
|
|
||||||
|
set only_screen_axo 1
|
Loading…
x
Reference in New Issue
Block a user