From: skv Date: Thu, 13 Mar 2014 10:24:28 +0000 (+0400) Subject: 0024667: BRepOffsetAPI_MakePipe::FirstShape() and LastShape() return shapes not from... X-Git-Tag: V6_8_0_beta~493 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=2cd138b87893ea3df63218a08cde6264cdb24274;hp=cb389a77e4b77d1b1b78df9f9e5562fa6e60692c 0024667: BRepOffsetAPI_MakePipe::FirstShape() and LastShape() return shapes not from result Test case for issue CR24667 --- diff --git a/src/BRepFill/BRepFill_Pipe.cxx b/src/BRepFill/BRepFill_Pipe.cxx index 2daa9e0a80..8620b0e7b5 100644 --- a/src/BRepFill/BRepFill_Pipe.cxx +++ b/src/BRepFill/BRepFill_Pipe.cxx @@ -639,6 +639,15 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S, MkSw.Build( myReversedEdges, myTapes, BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax ); result = MkSw.Shape(); + + Handle(TopTools_HArray2OfShape) aSections = MkSw.Sections(); + + if (aSections.IsNull() == Standard_False) { + const Standard_Integer aVLast = aSections->UpperCol(); + + myFirst = aSections->Value(1, 1); + myLast = aSections->Value(1, aVLast); + } } if (TheS.ShapeType() == TopAbs_WIRE ) { diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx index 661e057e4a..6d033ded48 100755 --- a/src/QABugs/QABugs_19.cxx +++ b/src/QABugs/QABugs_19.cxx @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include @@ -1724,6 +1726,64 @@ static Standard_Integer OCC24622 (Draw_Interpretor& /*theDi*/, Standard_Integer return 0; } +//======================================================================= +//function : OCC24667 +//purpose : +//======================================================================= +static Standard_Integer OCC24667 (Draw_Interpretor& di, Standard_Integer n, const char** a) +{ + if (n == 1) + { + di << "OCC24667 result Wire_spine Profile [Mode [Approx]]" << "\n"; + di << "Mode = 0 - CorrectedFrenet," << "\n"; + di << " = 1 - Frenet," << "\n"; + di << " = 2 - DiscreteTrihedron" << "\n"; + di << "Approx - force C1-approximation if result is C0" << "\n"; + return 0; + } + + if (n > 1 && n < 4) return 1; + + TopoDS_Shape Spine = DBRep::Get(a[2],TopAbs_WIRE); + if ( Spine.IsNull()) return 1; + + TopoDS_Shape Profile = DBRep::Get(a[3]); + if ( Profile.IsNull()) return 1; + + GeomFill_Trihedron Mode = GeomFill_IsCorrectedFrenet; + if (n >= 5) + { + Standard_Integer iMode = atoi(a[4]); + if (iMode == 1) + Mode = GeomFill_IsFrenet; + else if (iMode == 2) + Mode = GeomFill_IsDiscreteTrihedron; + } + + Standard_Boolean ForceApproxC1 = Standard_False; + if (n >= 6) + ForceApproxC1 = Standard_True; + + BRepOffsetAPI_MakePipe aPipe(TopoDS::Wire(Spine), + Profile, + Mode, + ForceApproxC1); + + TopoDS_Shape S = aPipe.Shape(); + TopoDS_Shape aSF = aPipe.FirstShape(); + TopoDS_Shape aSL = aPipe.LastShape(); + + DBRep::Set(a[1],S); + + TCollection_AsciiString aStrF(a[1], "_f"); + TCollection_AsciiString aStrL(a[1], "_l"); + + DBRep::Set(aStrF.ToCString(), aSF); + DBRep::Set(aStrL.ToCString(), aSL); + + return 0; +} + void QABugs::Commands_19(Draw_Interpretor& theCommands) { const char *group = "QABugs"; @@ -1759,9 +1819,7 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) { theCommands.Add ("OCC24012", "OCC24012 face edge", __FILE__, OCC24012, group); theCommands.Add ("OCC24051", "OCC24051", __FILE__, OCC24051, group); theCommands.Add ("OCC24086", "OCC24086 face wire", __FILE__, OCC24086, group); - theCommands.Add ("OCC24622", - "OCC24622 texture={1D|2D}\n" - " Tests sourcing of 1D/2D pixmaps for AIS_TexturedShape.\n", - __FILE__, OCC24622, group); + theCommands.Add ("OCC24622", "OCC24622 texture={1D|2D}\n Tests sourcing of 1D/2D pixmaps for AIS_TexturedShape", __FILE__, OCC24622, group); + theCommands.Add ("OCC24667", "OCC24667 result Wire_spine Profile [Mode [Approx]], no args to get help", __FILE__, OCC24667, group); return; } diff --git a/tests/bugs/modalg_5/bug24667 b/tests/bugs/modalg_5/bug24667 new file mode 100644 index 0000000000..1d0b290be8 --- /dev/null +++ b/tests/bugs/modalg_5/bug24667 @@ -0,0 +1,34 @@ +puts "============" +puts "OCC24667" +puts "============" +puts "" +############################################################################################### +# BRepOffsetAPI_MakePipe::FirstShape() and LastShape() return shapes not from result +############################################################################################### + +pload QAcommands + +vertex v1 0 0 0 +vertex v2 0 0 100 +vertex v3 0 -50 0 + +edge e v1 v2 +wire w e +OCC24667 r w v3 + +compound r r_f r_l result + +set length 100 + +# Analysis of "nbshapes result" +set nb_v_good 2 +set nb_e_good 1 +set nb_w_good 1 +set nb_f_good 0 +set nb_sh_good 0 +set nb_sol_good 0 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 5 + +set 2dviewer 1