From: msv Date: Thu, 9 Apr 2015 12:03:01 +0000 (+0300) Subject: 0026016: BRepPrimAPI_MakeRevol crash X-Git-Tag: V6_9_0_beta1~37 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=24e40cc2dc9f3321cfd546df4ab9164793c7e90b 0026016: BRepPrimAPI_MakeRevol crash Correctly treat the case when the line is a trimmed curve. Test-case for issue #26016 --- diff --git a/src/BRepSweep/BRepSweep_Rotation.cxx b/src/BRepSweep/BRepSweep_Rotation.cxx index 52ad5204ec..1551cc8256 100644 --- a/src/BRepSweep/BRepSweep_Rotation.cxx +++ b/src/BRepSweep/BRepSweep_Rotation.cxx @@ -435,8 +435,17 @@ void BRepSweep_Rotation::SetGeneratingPCurve if (AS.GetType()==GeomAbs_Plane){ gp_Pln pln = AS.Plane(); gp_Ax3 ax3 = pln.Position(); - Handle(Geom_Line) GL = Handle(Geom_Line)::DownCast - (BRep_Tool::Curve(TopoDS::Edge(aNewEdge),Loc,First,Last)); + Handle(Geom_Curve) aC = BRep_Tool::Curve(TopoDS::Edge(aNewEdge),Loc,First,Last); + Handle(Geom_Line) GL = Handle(Geom_Line)::DownCast(aC); + if (GL.IsNull()) { + Handle(Geom_TrimmedCurve) aTrimmedCurve = Handle(Geom_TrimmedCurve)::DownCast(aC); + if (!aTrimmedCurve.IsNull()) { + GL = Handle(Geom_Line)::DownCast(aTrimmedCurve->BasisCurve()); + if (GL.IsNull()) { + Standard_ConstructionError::Raise("BRepSweep_Rotation::SetGeneratingPCurve"); + } + } + } gp_Lin gl = GL->Lin(); gl.Transform(Loc.Transformation()); point = gl.Location(); diff --git a/tests/bugs/modalg_6/bug26016 b/tests/bugs/modalg_6/bug26016 new file mode 100644 index 0000000000..e7610bf5a7 --- /dev/null +++ b/tests/bugs/modalg_6/bug26016 @@ -0,0 +1,21 @@ +puts "========" +puts "OCC26016" +puts "========" +puts "" +##@@########################### +# BRepPrimAPI_MakeRevol crash +############################### + +smallview + +restore [locate_data_file OCC26016-revolve-crash.brep] a +revol r a 0 0 0 0 1 0 90 +set bug_info [checkshape r] + +if {[string compare $bug_info "This shape seems to be valid"] != 0} { + puts "ERROR: OCC26016 is reproduced" +} + +donly r +fit +set only_screen_axo 1