From ce39340ec949f7bef133a82cc6442c2ada041ee4 Mon Sep 17 00:00:00 2001 From: skl Date: Mon, 25 Jun 2007 08:45:41 +0000 Subject: [PATCH] Correction of next problem from bug NPAL14857. --- src/GEOMImpl/GEOMImpl_PipeDriver.cxx | 40 +++++++++++++++------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index f4c49d059..320debb03 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -39,6 +39,8 @@ #include #include #include +#include +#include #include #include @@ -69,7 +71,7 @@ #include "utilities.h" -#include "BRepTools.hxx" +//#include "BRepTools.hxx" //======================================================================= @@ -586,6 +588,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, CreateFewSolids = true; } + /* // check orientation of sections bool NeedReverse = false; { @@ -653,9 +656,9 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, } } } - //cout<<"VN("<PI/2.)) { + cout<<"VN("<PI/2.) { NeedReverse = true; aShBase1.Reverse(); } @@ -727,10 +730,10 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, } //cout<<"VN("<PI/2.)) + if(fabs(VN.Angle(PathNorm))>PI/2.) aShBase2.Reverse(); } - + */ if(!CreateFewSolids) { // we can create only one solid @@ -804,10 +807,6 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, for ( anExp.Init( aShBase2, TopAbs_FACE ); anExp.More(); anExp.Next() ) { B.Add(aShell,anExp.Current()); } - if(NeedReverse) { - cout<<"shell is reversed"<SetTolerance(Precision::Confusion()); @@ -821,6 +820,11 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, const TopoDS_Shape aSewShape = aSewing->SewedShape(); if( aSewShape.ShapeType() == TopAbs_SHELL ) { aShell = TopoDS::Shell(aSewShape); + GProp_GProps aSystem; + BRepGProp::VolumeProperties(aShell, aSystem); + if(aSystem.Mass()<0) { + aShell.Reverse(); + } if(BRep_Tool::IsClosed(aShell)) { TopoDS_Solid aSolid; B.MakeSolid(aSolid); @@ -1006,7 +1010,6 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, // make pipe for each pair of faces - //BRepTools::Write(WPath,"/dn02/users_Linux/skl/work/Bugs/14857/wpath.brep"); for(j=1; j<=FF.Extent(); j++) { TopoDS_Shape F1 = FF.FindKey(j); if( F1.ShapeType() != TopAbs_FACE ) @@ -1031,18 +1034,12 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, TopoDS_Shape aShape = aBuilder.Shape(); TopoDS_Shell aShell; B.MakeShell(aShell); - //int nbf=0; for ( anExp.Init( aShape, TopAbs_FACE ); anExp.More(); anExp.Next() ) { - //nbf++; - //cout<<"nbf="<SetTolerance(Precision::Confusion()); @@ -1056,6 +1053,12 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, const TopoDS_Shape aSewShape = aSewing->SewedShape(); if( aSewShape.ShapeType() == TopAbs_SHELL ) { aShell = TopoDS::Shell(aSewShape); + GProp_GProps aSystem; + BRepGProp::VolumeProperties(aShell, aSystem); + if(aSystem.Mass()<0) { + //cout<<"aSewShape is reversed"<