1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-21 10:55:33 +03:00

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
This commit is contained in:
abk 2012-12-28 19:52:02 +04:00
parent 9aaa3cc42c
commit 1566c54533
5 changed files with 62 additions and 9 deletions

View File

@ -257,6 +257,56 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
const TopoDS_Shape& aS2 = myS2; const TopoDS_Shape& aS2 = myS2;
// //
myShape.Nullify(); 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=new BOPAlgo_BOP;
myBuilder->AddArgument(aS1); myBuilder->AddArgument(aS1);
@ -269,6 +319,7 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
myErrorStatus=0; myErrorStatus=0;
myBuilderCanWork=Standard_True; myBuilderCanWork=Standard_True;
myShape=myBuilder->Shape(); myShape=myBuilder->Shape();
EnsureToleranceRule(myShape);
Done(); Done();
} }
else { else {

View File

@ -135,12 +135,12 @@ void BRepBuilderAPI_MakeShape::EnsureToleranceRule(const TopoDS_Shape & theS)
for (TopExp_Explorer aFE(theS, TopAbs_FACE); aFE.More(); aFE.Next()) for (TopExp_Explorer aFE(theS, TopAbs_FACE); aFE.More(); aFE.Next())
{ {
TopoDS_Face aF = TopoDS::Face(aFE.Current()); 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()) for (TopExp_Explorer anEE(aF, TopAbs_EDGE); anEE.More(); anEE.Next())
{ {
TopoDS_Edge anES = TopoDS::Edge(anEE.Current()); 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(); Standard_Real anET = anEG->Tolerance();
if (anET < aFT) 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()) for (TopExp_Explorer aVE(anES, TopAbs_VERTEX); aVE.More(); aVE.Next())
{ {
TopoDS_Vertex aVS = TopoDS::Vertex(aVE.Current()); 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); aVG->UpdateTolerance(anET);
} }
} }
@ -159,7 +159,7 @@ void BRepBuilderAPI_MakeShape::EnsureToleranceRule(const TopoDS_Shape & theS)
aVE.More(); aVE.Next()) aVE.More(); aVE.Next())
{ {
TopoDS_Vertex aVS = TopoDS::Vertex(aVE.Current()); 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); aVG->UpdateTolerance(aFT);
} }
} }
@ -168,12 +168,12 @@ void BRepBuilderAPI_MakeShape::EnsureToleranceRule(const TopoDS_Shape & theS)
anEE.More(); anEE.Next()) anEE.More(); anEE.Next())
{ {
TopoDS_Edge anES = TopoDS::Edge(anEE.Current()); 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(); Standard_Real anET = anEG->Tolerance();
for (TopExp_Explorer aVE(anES, TopAbs_VERTEX); aVE.More(); aVE.Next()) for (TopExp_Explorer aVE(anES, TopAbs_VERTEX); aVE.More(); aVE.Next())
{ {
TopoDS_Vertex aVS = TopoDS::Vertex(aVE.Current()); 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); aVG->UpdateTolerance(anET);
} }
} }

View File

@ -463,6 +463,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
} }
} }
} }
EnsureToleranceRule(myShape);
/* // loop of control of descendance /* // loop of control of descendance
TopExp_Explorer expr(mySbase, TopAbs_FACE); TopExp_Explorer expr(mySbase, TopAbs_FACE);

View File

@ -225,6 +225,7 @@ void BRepOffsetAPI_MakePipeShell::Delete( const TopoDS_Shape& Profile)
Ok = myPipe->Build(); Ok = myPipe->Build();
if (Ok) { if (Ok) {
myShape = myPipe->Shape(); myShape = myPipe->Shape();
EnsureToleranceRule(myShape);
Done(); Done();
} }
else NotDone(); else NotDone();

View File

@ -859,12 +859,12 @@ void BRepTest::SweepCommands(Draw_Interpretor& theCommands)
"deletesweep wire, To delete a section", "deletesweep wire, To delete a section",
__FILE__,deletesweep,g); __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); __FILE__,buildsweep,g);
theCommands.Add("simulsweep", "simulsweep r [n] [option]" theCommands.Add("simulsweep", "simulsweep r [n] [option]",
__FILE__,simulsweep,g); __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); __FILE__,geompipe,g);
theCommands.Add("middlepath", "middlepath res shape startshape endshape", theCommands.Add("middlepath", "middlepath res shape startshape endshape",