From: aka Date: Thu, 8 Dec 2016 13:22:13 +0000 (+0300) Subject: 0027674: BRepOffsetAPI_ThruSections make invalid shape if sections are connected... X-Git-Tag: V_01_2017_06_30~111 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=851f870162b3a87d274dec032adda001644d5171;p=occt.git 0027674: BRepOffsetAPI_ThruSections make invalid shape if sections are connected at ends The edge which will be created between same vertexes should be degenerated and without 3d curve. Small correction of test case for issue CR27674 --- diff --git a/src/BRepFill/BRepFill_Generator.cxx b/src/BRepFill/BRepFill_Generator.cxx index 6e70529a99..19c47ba806 100644 --- a/src/BRepFill/BRepFill_Generator.cxx +++ b/src/BRepFill/BRepFill_Generator.cxx @@ -728,37 +728,52 @@ void BRepFill_Generator::Perform() // make the missing edges Standard_Real first,last; Surf->Bounds(f1,l1,f2,l2); + if (IType == 0) + { + first = f2; + last = l2; + } + else + { + first = 0.; + last = 1.; + } if ( Map.IsBound(Vf_toMap)) { TopoDS_Shape aLocalShape = Map(Vf_toMap).Reversed(); Edge3 = TopoDS::Edge(aLocalShape); // Edge3 = TopoDS::Edge(Map(V1f).Reversed()); } - else { - Handle(Geom_Curve) CC; - TColgp_Array1OfPnt Extremities(1,2); - if (IType==0) { - // general case : Edge3 corresponds to iso U=f1 - CC = Surf->UIso(f1); - first=f2; - last=l2; - } - else { - // particular case : it is required to calculate the curve 3d - Extremities(1) = BRep_Tool::Pnt(V1f); - Extremities(2) = BRep_Tool::Pnt(V2f); - CC = new Geom_BezierCurve(Extremities); - first=0.; - last=1.; - } - B.MakeEdge(Edge3,CC,Precision::Confusion()); - V1f.Orientation(TopAbs_FORWARD); - B.Add(Edge3,V1f); - V2f.Orientation(TopAbs_REVERSED); - B.Add(Edge3,V2f); - B.Range(Edge3,first,last); - Edge3.Reverse(); - Map.Bind(Vf_toMap, Edge3); + else + { + if (V1f.IsSame(V2f)) + { + B.MakeEdge(Edge3); + B.Degenerated(Edge3, Standard_True); + } + else + { + Handle(Geom_Curve) CC; + TColgp_Array1OfPnt Extremities(1, 2); + if (IType == 0) { + // general case : Edge3 corresponds to iso U=f1 + CC = Surf->UIso(f1); + } + else { + // particular case : it is required to calculate the curve 3d + Extremities(1) = BRep_Tool::Pnt(V1f); + Extremities(2) = BRep_Tool::Pnt(V2f); + CC = new Geom_BezierCurve(Extremities); + } + B.MakeEdge(Edge3, CC, Precision::Confusion()); + } + V1f.Orientation(TopAbs_FORWARD); + B.Add(Edge3, V1f); + V2f.Orientation(TopAbs_REVERSED); + B.Add(Edge3, V2f); + B.Range(Edge3, first, last); + Edge3.Reverse(); + Map.Bind(Vf_toMap, Edge3); } Standard_Boolean CommonEdge = Standard_False; @@ -775,30 +790,35 @@ void BRepFill_Generator::Perform() Edge4 = TopoDS::Edge(aLocalShape); // Edge4 = TopoDS::Edge(Map(V1l).Reversed()); } - else { - Handle(Geom_Curve) CC; - TColgp_Array1OfPnt Extremities(1,2); - if (IType==0) { - // general case : Edge4 corresponds to iso U=l1 - CC = Surf->UIso(l1); - first=f2; - last=l2; - } - else { - // particular case : it is required to calculate the curve 3d - Extremities(1) = BRep_Tool::Pnt(V1l); - Extremities(2) = BRep_Tool::Pnt(V2l); - CC = new Geom_BezierCurve(Extremities); - first=0.; - last=1.; - } - B.MakeEdge(Edge4,CC,Precision::Confusion()); - V1l.Orientation(TopAbs_FORWARD); - B.Add(Edge4,V1l); - V2l.Orientation(TopAbs_REVERSED); - B.Add(Edge4,V2l); - B.Range(Edge4,first,last); - Map.Bind(Vl_toMap, Edge4); + else + { + if (V1l.IsSame(V2l)) + { + B.MakeEdge(Edge4); + B.Degenerated(Edge4, Standard_True); + } + else + { + Handle(Geom_Curve) CC; + TColgp_Array1OfPnt Extremities(1, 2); + if (IType == 0) { + // general case : Edge4 corresponds to iso U=l1 + CC = Surf->UIso(l1); + } + else { + // particular case : it is required to calculate the curve 3d + Extremities(1) = BRep_Tool::Pnt(V1l); + Extremities(2) = BRep_Tool::Pnt(V2l); + CC = new Geom_BezierCurve(Extremities); + } + B.MakeEdge(Edge4, CC, Precision::Confusion()); + } + V1l.Orientation(TopAbs_FORWARD); + B.Add(Edge4, V1l); + V2l.Orientation(TopAbs_REVERSED); + B.Add(Edge4, V2l); + B.Range(Edge4, first, last); + Map.Bind(Vl_toMap, Edge4); } // make the wire diff --git a/tests/bugs/modalg_6/bug27674 b/tests/bugs/modalg_6/bug27674 new file mode 100644 index 0000000000..edc996b295 --- /dev/null +++ b/tests/bugs/modalg_6/bug27674 @@ -0,0 +1,47 @@ +puts "============" +puts "OCC27674" +puts "============" +puts "" +############################################################################ +# BRepOffsetAPI_ThruSections make invalid +# shape if sections are connected at ends +############################################################################ + +restore [locate_data_file bug27674_CircleLineWires.brep] a + +explode a +wire w a_1 a_2 +explode w +wire a1 w_1 +wire a2 w_2 +thrusections r 0 0 a1 a2 +checkshape r + +checknbshapes r -vertex 2 -edge 4 + +puts "Check that edges degenerated and has no 3d curve..." +explode r E +if [regexp {degenerated} [dump r_2]] { + puts "OK: r_2 is a degenerated edge." + if [catch {mkcurve c1 r_2} catch_result] { + puts "OK: r_2 has no 3d curve." + } else { + puts "Faulty: r_2 has 3d curve" + } +} else { + puts "Faulty: r_2 is not degenerated edge." +} + +if [regexp {degenerated} [dump r_4]] { + puts "OK: r_4 is a degenerated edge." + if [catch {mkcurve c1 r_4} catch_result] { + puts "OK: r_4 has no 3d curve." + } else { + puts "Faulty: r_4 has 3d curve" + } +} else { + puts "Faulty: r_4 is not degenerated edge." +} + +checkview -display r -2d -path ${imagedir}/${test_image}.png +