From 1566c54533d9dfd9ffc09a5cd8a17d889363c028 Mon Sep 17 00:00:00 2001 From: abk Date: Fri, 28 Dec 2012 19:52:02 +0400 Subject: [PATCH] Method BRepBuilderAPI_MakeShape::EnsureToleranceRule was made slightly simpler. Tolerance post Build (Perform) fix was made for: - BRepAlgoAPI_BooleanOperation, - BRepFeat_MakePrism, - BRepOffsetAPI_MakePipeShell. Draw command getsourcefile now returns result for: - buildsweep, - simulsweep, - geompipe. Conflicts: src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx --- .../BRepAlgoAPI_BooleanOperation.cxx | 51 +++++++++++++++++++ .../BRepBuilderAPI_MakeShape.cxx | 12 ++--- src/BRepFeat/BRepFeat_MakePrism.cxx | 1 + .../BRepOffsetAPI_MakePipeShell.cxx | 1 + src/BRepTest/BRepTest_SweepCommands.cxx | 6 +-- 5 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx index 460c333015..05814c2dbf 100755 --- a/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx +++ b/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx @@ -257,6 +257,56 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_ const TopoDS_Shape& aS2 = myS2; // myShape.Nullify(); + // + // SECTION + // + if (myOperation==BOP_SECTION) { + myBuilder=new BOP_Section; + } + // + // COMMON, FUSE, CUT12, CUT21 + // + else if (myOperation==BOP_COMMON || myOperation==BOP_FUSE || + myOperation==BOP_CUT || myOperation==BOP_CUT21) { + // + // Check whether one or both of the arguments is(are) empty shape(s) + // If yes, create BOP_EmptyBuilder object and build the result fast. + { + Standard_Boolean bIsEmptyShape1, bIsEmptyShape2; + + bIsEmptyShape1=BOPTools_Tools3D::IsEmptyShape(aS1); + bIsEmptyShape2=BOPTools_Tools3D::IsEmptyShape(aS2); + // + if (bIsEmptyShape1 || bIsEmptyShape2) { + myBuilder=new BOP_EmptyBuilder; + // + if (myBuilder==NULL) { + myErrorStatus=7; + return ; + } + // + myBuilder->SetShapes(aS1, aS2); + myBuilder->SetOperation (myOperation); + myBuilder->DoWithFiller (*myDSFiller); + + bIsDone=myBuilder->IsDone(); + + if (bIsDone) { + myErrorStatus=0; + myBuilderCanWork=Standard_True; + myShape=myBuilder->Result(); + EnsureToleranceRule(myShape); + Done(); + } + else { + myErrorStatus=100+myBuilder->ErrorStatus(); + NotDone(); + } + return; + } + } + // + TopAbs_ShapeEnum aT1, aT2; myBuilder=new BOPAlgo_BOP; myBuilder->AddArgument(aS1); @@ -269,6 +319,7 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_ myErrorStatus=0; myBuilderCanWork=Standard_True; myShape=myBuilder->Shape(); + EnsureToleranceRule(myShape); Done(); } else { diff --git a/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx b/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx index 8c8cfe85c8..bd64f1aef8 100755 --- a/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx +++ b/src/BRepBuilderAPI/BRepBuilderAPI_MakeShape.cxx @@ -135,12 +135,12 @@ void BRepBuilderAPI_MakeShape::EnsureToleranceRule(const TopoDS_Shape & theS) for (TopExp_Explorer aFE(theS, TopAbs_FACE); aFE.More(); aFE.Next()) { TopoDS_Face aF = TopoDS::Face(aFE.Current()); - Standard_Real aFT = (*((Handle_BRep_TFace *)&aF.TShape()))->Tolerance(); + Standard_Real aFT = ((Handle_BRep_TFace &)aF.TShape())->Tolerance(); // for (TopExp_Explorer anEE(aF, TopAbs_EDGE); anEE.More(); anEE.Next()) { TopoDS_Edge anES = TopoDS::Edge(anEE.Current()); - Handle_BRep_TEdge & anEG = *(Handle_BRep_TEdge *)&anES.TShape(); + Handle_BRep_TEdge & anEG = (Handle_BRep_TEdge &)anES.TShape(); Standard_Real anET = anEG->Tolerance(); if (anET < aFT) { @@ -150,7 +150,7 @@ void BRepBuilderAPI_MakeShape::EnsureToleranceRule(const TopoDS_Shape & theS) for (TopExp_Explorer aVE(anES, TopAbs_VERTEX); aVE.More(); aVE.Next()) { TopoDS_Vertex aVS = TopoDS::Vertex(aVE.Current()); - Handle_BRep_TVertex & aVG = *(Handle_BRep_TVertex *)&aVS.TShape(); + Handle_BRep_TVertex & aVG = (Handle_BRep_TVertex &)aVS.TShape(); aVG->UpdateTolerance(anET); } } @@ -159,7 +159,7 @@ void BRepBuilderAPI_MakeShape::EnsureToleranceRule(const TopoDS_Shape & theS) aVE.More(); aVE.Next()) { TopoDS_Vertex aVS = TopoDS::Vertex(aVE.Current()); - Handle_BRep_TVertex & aVG = *(Handle_BRep_TVertex *)&aVS.TShape(); + Handle_BRep_TVertex & aVG = (Handle_BRep_TVertex &)aVS.TShape(); aVG->UpdateTolerance(aFT); } } @@ -168,12 +168,12 @@ void BRepBuilderAPI_MakeShape::EnsureToleranceRule(const TopoDS_Shape & theS) anEE.More(); anEE.Next()) { TopoDS_Edge anES = TopoDS::Edge(anEE.Current()); - Handle_BRep_TEdge & anEG = *(Handle_BRep_TEdge *)&anES.TShape(); + Handle_BRep_TEdge & anEG = (Handle_BRep_TEdge &)anES.TShape(); Standard_Real anET = anEG->Tolerance(); for (TopExp_Explorer aVE(anES, TopAbs_VERTEX); aVE.More(); aVE.Next()) { TopoDS_Vertex aVS = TopoDS::Vertex(aVE.Current()); - Handle_BRep_TVertex & aVG = *(Handle_BRep_TVertex *)&aVS.TShape(); + Handle_BRep_TVertex & aVG = (Handle_BRep_TVertex &)aVS.TShape(); aVG->UpdateTolerance(anET); } } diff --git a/src/BRepFeat/BRepFeat_MakePrism.cxx b/src/BRepFeat/BRepFeat_MakePrism.cxx index ba3f39f5b2..c95badcf42 100755 --- a/src/BRepFeat/BRepFeat_MakePrism.cxx +++ b/src/BRepFeat/BRepFeat_MakePrism.cxx @@ -463,6 +463,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until) } } } + EnsureToleranceRule(myShape); /* // loop of control of descendance TopExp_Explorer expr(mySbase, TopAbs_FACE); diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx index f1189fa3ec..e0f58cb9e3 100755 --- a/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_MakePipeShell.cxx @@ -225,6 +225,7 @@ void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile) Ok = myPipe->Build(); if (Ok) { myShape = myPipe->Shape(); + EnsureToleranceRule(myShape); Done(); } else NotDone(); diff --git a/src/BRepTest/BRepTest_SweepCommands.cxx b/src/BRepTest/BRepTest_SweepCommands.cxx index 631d9f15ff..bff9a2e8e6 100755 --- a/src/BRepTest/BRepTest_SweepCommands.cxx +++ b/src/BRepTest/BRepTest_SweepCommands.cxx @@ -859,12 +859,12 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands) "deletesweep wire, To delete a section", __FILE__,deletesweep,g); - theCommands.Add("buildsweep", "builsweep [r] [option] [Tol] , no args to get help" + theCommands.Add("buildsweep", "buildsweep [r] [option] [Tol] , no args to get help", __FILE__,buildsweep,g); - theCommands.Add("simulsweep", "simulsweep r [n] [option]" + theCommands.Add("simulsweep", "simulsweep r [n] [option]", __FILE__,simulsweep,g); - theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]" + theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]", __FILE__,geompipe,g); theCommands.Add("middlepath", "middlepath res shape startshape endshape",