diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index d84397a4c..aab459299 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -209,17 +209,13 @@ static bool FillForOtherEdges(const TopoDS_Shape& F1, const TopoDS_Shape& V1, TopTools_IndexedDataMapOfShapeShape& FF) { - //cout<<"FillForOtherEdges"<IsKind(STANDARD_TYPE(Geom_Plane))) { + nbPlanar++; + } + else if (aS->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { + Handle(Geom_RectangularTrimmedSurface) aTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aS); + if (aTS->BasisSurface()->IsKind(STANDARD_TYPE(Geom_Plane))) { + nbPlanar++; + } + } + aS = BRep_Tool::Surface(TopoDS::Face(aSh2)); + if (aS->IsKind(STANDARD_TYPE(Geom_Plane))) { + nbPlanar++; + } + else if (aS->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) { + Handle(Geom_RectangularTrimmedSurface) aTS = Handle(Geom_RectangularTrimmedSurface)::DownCast(aS); + if (aTS->BasisSurface()->IsKind(STANDARD_TYPE(Geom_Plane))) { + nbPlanar++; + } + } + } + if (nbPlanar < 2) { + TopoDS_Shape aPipe = aBuilder.Shape(); + // make sewing for result + Handle(BRepBuilderAPI_Sewing) aSewing = new BRepBuilderAPI_Sewing; + Standard_Real aTol = Precision::Confusion(); + aSewing->SetTolerance(aTol); + aSewing->SetFaceMode(Standard_True); + aSewing->SetFloatingEdgesMode(Standard_False); + aSewing->SetNonManifoldMode(Standard_False); + TopExp_Explorer anExp; + for (anExp.Init(aPipe, TopAbs_FACE); anExp.More(); anExp.Next()) { + aSewing->Add(anExp.Current()); + } + aSewing->Add(aSh1); + aSewing->Add(aSh2); + aSewing->Perform(); + aShape = aSewing->SewedShape(); + if (aShape.ShapeType() == TopAbs_SHELL) { + // Build a solid. + BRepBuilderAPI_MakeSolid aMkSolid; + aMkSolid.Add(TopoDS::Shell(aShape)); + if (!aMkSolid.IsDone()) { + isDone = Standard_False; + } + else { + TopoDS_Solid aSolid = aMkSolid.Solid(); + BRepClass3d_SolidClassifier aSC(aSolid); + aSC.PerformInfinitePoint(Precision::Confusion()); + if (aSC.State() == TopAbs_IN) { + aShape = aSolid.Reversed(); + } + else { + aShape = aSolid; + } + } + } + else { + isDone = Standard_False; + } + } + else { + isDone = Standard_False; + } + if (!isDone) { + isDone = aBuilder.MakeSolid(); + if (isDone) { + aShape = aBuilder.Shape(); + } + } + return isDone; +} + //======================================================================= //function : CreatePipeWithDifferentSections //purpose : @@ -845,7 +897,6 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections double tol = BRep_Tool::Tolerance(edge); TopoDS_Vertex VF = sae.FirstVertex(edge); gp_Pnt PF = BRep_Tool::Pnt(VF); - //cout<<"PF("< tol) { Standard_ConstructionError::Raise ("First location shapes is not coincided with first vertex of aWirePath"); @@ -981,7 +1032,6 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections P1 = P2; } int LastLoc = 1; - //cout<<"Edges.Length()="< tol) { if (aCI) delete aCI; Standard_ConstructionError::Raise @@ -1966,8 +2021,7 @@ static TopoDS_Shape CreatePipeForShellSections(const TopoDS_Wire& aWirePath, aShell = TopoDS::Shell(aSewShape); GProp_GProps aSystem; BRepGProp::VolumeProperties(aShell, aSystem); - if (aSystem.Mass()<0) { - //cout<<"aSewShape is reversed"<edge for created pipe edges TopTools_IndexedDataMapOfShapeShape VPE; ShapeAnalysis_Edge sae; - //cout<<"FF.Extent()="<IsKind(STANDARD_TYPE(Geom_Conic))) { - // IsConicC1 = true; - // cout<<"C1 - Geom_Conic"<IsKind(STANDARD_TYPE(Geom_Line)) || C1->IsKind(STANDARD_TYPE(Geom_Conic))) { C1 = new Geom_TrimmedCurve(C1,fp,lp); } - //if (IsConicC1) { - // double tol = BRep_Tool::Tolerance(E1); - // GeomConvert_ApproxCurve ApxC1(C1,tol,GeomAbs_C1,10,5); - // C1 = ApxC1.Curve(); - //} Handle(Geom_Curve) C3 = BRep_Tool::Curve(E3,fp,lp); if (C3->IsKind(STANDARD_TYPE(Geom_Line)) || C3->IsKind(STANDARD_TYPE(Geom_Conic))) { C3 = new Geom_TrimmedCurve(C3,fp,lp); } - //filebuf fic; - //ostream os(&fic); - //os.precision(15); Handle(Geom_BSplineCurve) CE1 = GeomConvert::CurveToBSplineCurve(C1,Convert_RationalC1); if (CE1->Degree()<3) @@ -2475,8 +2513,7 @@ static TopoDS_Shape CreatePipeShellsWithoutPath(GEOMImpl_IPipe* aCI) aShell = TopoDS::Shell(aSewShape); GProp_GProps aSystem; BRepGProp::VolumeProperties(aShell, aSystem); - if (aSystem.Mass()<0) { - //cout<<"aSewShape is reversed"<