1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0024586: Pipe construction is failed

Test case for issue CR24586
This commit is contained in:
jgv 2014-02-13 12:46:57 +04:00 committed by apn
parent af203d549a
commit f52d1b53c4
3 changed files with 84 additions and 20 deletions

View File

@ -53,6 +53,7 @@
#include <Geom_OffsetCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <BRepLib.hxx>
@ -60,11 +61,42 @@
#include <GeomAdaptor_HSurface.hxx>
#include <Adaptor3d_CurveOnSurface.hxx>
#include <ShapeUpgrade_RemoveLocations.hxx>
#ifdef DRAW
#include <DBRep.hxx>
static Standard_Boolean Affich = 0;
#endif
static void ReverseModifiedEdges(TopoDS_Shape& aShape,
TopTools_MapOfShape& Emap)
{
TopExp_Explorer Explo(aShape, TopAbs_FACE);
BRep_Builder BB;
for (; Explo.More(); Explo.Next())
{
TopoDS_Shape aFace = Explo.Current();
TopoDS_Iterator itf(aFace);
for (; itf.More(); itf.Next())
{
TopoDS_Shape aWire = itf.Value();
TopTools_SequenceOfShape ModEdges;
TopoDS_Iterator itw(aWire);
for (; itw.More(); itw.Next())
{
TopoDS_Shape anEdge = itw.Value();
if (Emap.Contains(anEdge))
ModEdges.Append(anEdge);
}
aWire.Free(Standard_True);
for (Standard_Integer ii = 1; ii <= ModEdges.Length(); ii++)
{
BB.Remove(aWire, ModEdges(ii));
BB.Add(aWire, ModEdges(ii).Reversed());
}
}
}
}
static void UpdateTolFromTopOrBottomPCurve(const TopoDS_Face& aFace,
TopoDS_Edge& anEdge)
@ -237,6 +269,18 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine,
myFirst = BRepBuilderAPI_Transform(myProfile, fila, Standard_True); //copy
}
ShapeUpgrade_RemoveLocations RemLoc;
RemLoc.Remove(myFirst);
myFirst = RemLoc.GetResult();
TopLoc_Location theLoc = myFirst.Location();
if (!theLoc.IsIdentity())
{
TopoDS_Shape NewMyFirst = BRepBuilderAPI_Copy(myFirst);
TopLoc_Location theIdentity;
NewMyFirst.Location(theIdentity);
myFirst = BRepBuilderAPI_Transform(NewMyFirst, theLoc.Transformation());
}
myLoc->Law(myLoc->NbLaw())->GetDomain(first, last);
myLoc->Law(myLoc->NbLaw())->D0(last,M, V);
// try { // Not good, but there are no other means to test SetValues
@ -256,6 +300,18 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine,
else {
myLast = myFirst;
}
RemLoc.Remove(myLast);
myLast = RemLoc.GetResult();
theLoc = myLast.Location();
if (!theLoc.IsIdentity())
{
TopoDS_Shape NewMyLast = BRepBuilderAPI_Copy(myLast);
TopLoc_Location theIdentity;
NewMyLast.Location(theIdentity);
myLast = BRepBuilderAPI_Transform(NewMyLast, theLoc.Transformation());
}
#if DRAW
if (Affich) {
DBRep::Set("theprof", TheProf);
@ -595,6 +651,9 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S,
MkSw.Build( myReversedEdges, myTapes,
BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax );
result = MkSw.Shape();
//Correct <myFirst> and <myLast>
ReverseModifiedEdges(myFirst, myReversedEdges);
ReverseModifiedEdges(myLast, myReversedEdges);
// Labeling of elements
if (mySections.IsNull()) {

View File

@ -2066,26 +2066,6 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
Standard_Boolean exuv, singu, singv;
Handle(Geom_Surface) S;
// Preprocessing: correct <FirstShape> if the profile is shell
if (!ReversedEdges.IsEmpty())
{
TopTools_SequenceOfShape EdgesToReverse;
TopoDS_Iterator itw(FirstShape);
for (; itw.More(); itw.Next())
{
const TopoDS_Shape& anEdge = itw.Value();
if (ReversedEdges.Contains(anEdge))
EdgesToReverse.Append(anEdge);
}
FirstShape.Free(Standard_True);
for (Standard_Integer i = 1; i <= EdgesToReverse.Length(); i++)
{
B.Remove(FirstShape, EdgesToReverse(i));
EdgesToReverse(i).Reverse();
B.Add(FirstShape, EdgesToReverse(i));
}
}
// (2.0) return preexisting Edges and vertices
TopoDS_Edge E;
TColStd_Array1OfBoolean IsBuilt(1, NbLaw);
@ -2296,6 +2276,7 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section,
// ---------- Creation of Vertex and edge ------------
ReversedEdges.Clear();
for (ipath=1, IPath=IFirst; ipath<=NbPath;
ipath++, IPath++) {
for (isec=1; isec <=NbLaw; isec++) {

24
tests/bugs/modalg_5/bug24586 Executable file
View File

@ -0,0 +1,24 @@
puts "============"
puts "OCC24586"
puts "============"
puts ""
#######################################################################
# Pipe construction is failed
#######################################################################
restore [locate_data_file bug24586_base.brep] base
restore [locate_data_file bug24586_path.brep] path
pipe result path base
set nb_v_good 164
set nb_e_good 379
set nb_w_good 240
set nb_f_good 240
set nb_sh_good 24
set nb_sol_good 24
set nb_compsol_good 0
set nb_compound_good 1
set nb_shape_good 1072
set 2dviewer 1