X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_PipeDriver.cxx;h=9812da16af8b6518df08ad6fb722c75c6fe71e5c;hb=7965cd72610905458b4f389e82212349e7061aec;hp=2a5bcadca234c20708255ff1d00fe7440205e5da;hpb=20ffcb034a939e0a48edde0d02d649398d240128;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 2a5bcadca..9812da16a 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,19 +19,20 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -#include - #include -#include #include #include #include #include +#include #include #include + #include +#include + #include #include #include @@ -41,15 +42,14 @@ #include #include +#include +#include #include #include #include +#include #include #include -#include -#include -#include -#include #include #include @@ -68,6 +68,8 @@ #include #include +#include + #include #include #include @@ -88,19 +90,27 @@ #include #include + #include #include #include #include "utilities.h" +////////////////////////////////////////////////////////////////////////// +// Uncomment below macro to perform gluing in the end of MakePipe operation +// as fix of issue 0020207. +////////////////////////////////////////////////////////////////////////// +//#define GLUE_0020207 + + //======================================================================= //function : GetID //purpose : //======================================================================= const Standard_GUID& GEOMImpl_PipeDriver::GetID() { - static Standard_GUID aPipeDriver("FF1BBB19-5D14-4df2-980B-3A668264EA16"); + static Standard_GUID aPipeDriver ("FF1BBB19-5D14-4df2-980B-3A668264EA16"); return aPipeDriver; } @@ -2222,6 +2232,11 @@ static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath, Standard_NullObject::Raise("MakePipe aborted : null base argument"); } + // Make copy to prevent modifying of base object: 0021525 + BRepBuilderAPI_Copy Copy (aShapeBase); + if (Copy.IsDone()) + aShapeBase = Copy.Shape(); + TopoDS_Shape aProf; if (aShapeBase.ShapeType() == TopAbs_VERTEX) { aProf = aShapeBase; @@ -2233,14 +2248,14 @@ static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath, aProf = aShapeBase; } else if (aShapeBase.ShapeType() == TopAbs_FACE) { - TopExp_Explorer wexp(aShapeBase,TopAbs_WIRE); + TopExp_Explorer wexp (aShapeBase,TopAbs_WIRE); aProf = wexp.Current(); } else { Standard_TypeMismatch::Raise ("MakePipe aborted : invalid type of base"); } - BRepOffsetAPI_MakePipeShell PipeBuilder(aWirePath); + BRepOffsetAPI_MakePipeShell PipeBuilder (aWirePath); PipeBuilder.Add(aProf); if (aShapeVec.IsNull()) { @@ -2272,23 +2287,23 @@ static TopoDS_Shape CreatePipeBiNormalAlongVector(const TopoDS_Wire& aWirePath, //function : Execute //purpose : //======================================================================= -Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const +Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const { - //cout<<"PipeDriver::Execute"<GetType(); + + GEOMImpl_IPipe* aCI = 0; if (aType == PIPE_BASE_PATH) - aCI = new GEOMImpl_IPipe(aFunction); + aCI = new GEOMImpl_IPipe (aFunction); else if (aType == PIPE_DIFFERENT_SECTIONS) - aCI = new GEOMImpl_IPipeDiffSect(aFunction); + aCI = new GEOMImpl_IPipeDiffSect (aFunction); else if (aType == PIPE_SHELL_SECTIONS) - aCI = new GEOMImpl_IPipeShellSect(aFunction); + aCI = new GEOMImpl_IPipeShellSect (aFunction); else if (aType == PIPE_SHELLS_WITHOUT_PATH) - aCI = new GEOMImpl_IPipeShellSect(aFunction); + aCI = new GEOMImpl_IPipeShellSect (aFunction); else if (aType == PIPE_BI_NORMAL_ALONG_VECTOR) - aCI = new GEOMImpl_IPipeBiNormal(aFunction); + aCI = new GEOMImpl_IPipeBiNormal (aFunction); else return 0; @@ -2353,7 +2368,37 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const } // Make pipe - aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase); + if (aShapeBase.ShapeType() == TopAbs_EDGE || + aShapeBase.ShapeType() == TopAbs_WIRE) + { + TopoDS_Wire Profile; + if (aShapeBase.ShapeType() == TopAbs_WIRE) + Profile = TopoDS::Wire(aShapeBase); + else + { + BRep_Builder BB; + BB.MakeWire(Profile); + BB.Add(Profile, aShapeBase); + } + + BRepOffsetAPI_MakePipeShell Sweep (aWirePath); + BRepBuilderAPI_MakeFace FaceBuilder (aWirePath, Standard_True); //to find the plane of spine + if (FaceBuilder.IsDone()) + Sweep.SetMode(FaceBuilder.Face()); + Sweep.Add(Profile); + Sweep.Build(); + + if (!Sweep.IsDone()) + { + if (aCI) delete aCI; + Standard_ConstructionError::Raise("MakePipeShell failed"); + } + else + aShape = Sweep.Shape(); //result is good + + } + else + aShape = BRepOffsetAPI_MakePipe(aWirePath, aShapeBase); } //building pipe with different sections @@ -2439,6 +2484,8 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const } // Glue (for bug 0020207) + // No gluing is needed as the bug 0020207 is fixed in OCCT. +#ifdef GLUE_0020207 TopExp_Explorer anExpV (aShape, TopAbs_VERTEX); if (anExpV.More()) { Standard_Real aVertMaxTol = -RealLast(); @@ -2452,8 +2499,9 @@ Standard_Integer GEOMImpl_PipeDriver::Execute(TFunction_Logbook& log) const aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True); //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True); } +#endif - TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape); + TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape); aFunction->SetValue(aRes); log.SetTouched(Label());